• Gurleen Kaur
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
There is a use case in which we have to build a form using lightning-record-form. We have to display the set of fields from different unrelated records into that form in different accordion sections.

I was going through the documentation, it says that lightning-record-form accepts only one Object name and only one record Id.

So, is there any way that I can show fields of different unrelated records in a single form using lightning-record-form in LWC?
I have a Lightning Component which implements 'isURLAddressable' interface. I am calling this component from my Apex Class.

ApexClass
...
'/lightning/cmp/c__TestComp?c__param1=test';
...

Within Salesforce, this URL works fine and I get navigated to my TestComp component. But in Communities,it is not working.
I tried modifying the URL to below:

...

'/<CommunityURL>/lightning/cmp/c__TestComp?c__param1=test'
---- Not Working in Communities

OR

'/<CommunityURL>/cmp/c__TestComp?c__param1=test' ---- Not Working in Communities ...


Any idea on how can I call Lightning Component from Apex class which could work in Communities?
Currently, I am displaying a set of checkboxes on the screen using lightning-checkbox-group, but I need to disable one of the checkbox conditionally. So, looks like we have a 'disabled' attribute in lightning-checkbox-group but when set to true, it disables all the checkboxes. Below is the approach which I tried to disable only 'Second' checkbox, but it is not working:

myComp.html

<template>
<lightning-checkbox-group name="Checkbox Group"
                                           label="Checkbox Group"
                                           options={options}
                                            value={value}
                                            onchange={handleChange}
                                            disabled={options.disabled} >
</lightning-checkbox-group>
</template>

myComp.js

import { LightningElement, track } from 'lwc';
export default class CheckboxGroupBasic extends LightningElement { @track value = ['option1'];
get options() {
                return [
                                     { label: 'First', value: 'option1'},
                                     { label: 'Second', value: 'option2',disabled :true                                       },
                          ];
}
get selectedValues()
{
        return this.value.join(',');
}

handleChange(e)
{ this.value = e.detail.value;
}
}

But still it is not disabling the Second checkbox. Any suggestions?
Hi,

I am facing an issue in assigning attribute value for a component in saveResult method, inside helper class:
Component:
 <aura:attribute name="isOwnerDefined" type="String" default=""/>

<force:recordData aura:id="CntctTypeRecordCreator"
                          targetRecord="{!v.newContact}"
                          targetFields="{!v.CntctTypeResultFields}"
                          layoutType="FULL"
                          mode="EDIT" />
JS Controller :
component.find("CntctTypeRecordCreator").saveRecord($A.getCallback(function(saveResult) {
                if(saveResult.state === "SUCCESS" || saveResult.state === "DRAFT"){
                   for(var key in component.get("v.cntctTypesMap")){
                        if(component.get("v.selectedOption") == key){
                            helper.setContactTypeMAppingRec(component,key,saveResult.recordId);
                            break;
                        }
                    }
             }))
Helper:
setContactTypeMAppingRec : function(component,mappingName,recordId) {
        component.set("v.newCntctMappingField.Contact__c",recordId);
        component.set("v.newCntctMappingField.ContactType__c",component.get("v.cntctTypesMap")[mappingName]);
        component.set("v.newCntctMappingField.Name",mappingName);
        component.find("cnTypeRecordLoader").saveRecord($A.getCallback(function(saveResultContact) {
            if(saveResultContact.state === "SUCCESS" || saveResultContact.state === "DRAFT"){
                component.set("v.isOwnerDefined",'myTest');     // I have assigned string value to component attribute
                console.log('====' + component.get("v.isOwnerDefined")); // But here it returns "undefined"
                console.log('Contact Type mapping Saved!!');
            }
            else if (saveResultContact.state === "INCOMPLETE") 
                console.log('Server could not be reached. Check your internet connection!');
            else if (saveResultContact.state === "ERROR") 
                console.log('Exception Found!');
            else
                console.log('Error while loading Current Processor Picklist. Please contact your System Administrator.');
        }))
    }


Any Help?
Hi,

I am facing an issue in assigning attribute value for a component in saveResult method, inside helper class:
Component:
 <aura:attribute name="isOwnerDefined" type="String" default=""/>

<force:recordData aura:id="CntctTypeRecordCreator"
                          targetRecord="{!v.newContact}"
                          targetFields="{!v.CntctTypeResultFields}"
                          layoutType="FULL"
                          mode="EDIT" />
JS Controller :
component.find("CntctTypeRecordCreator").saveRecord($A.getCallback(function(saveResult) {
                if(saveResult.state === "SUCCESS" || saveResult.state === "DRAFT"){
                   for(var key in component.get("v.cntctTypesMap")){
                        if(component.get("v.selectedOption") == key){
                            helper.setContactTypeMAppingRec(component,key,saveResult.recordId);
                            break;
                        }
                    }
             }))
Helper:
setContactTypeMAppingRec : function(component,mappingName,recordId) {
        component.set("v.newCntctMappingField.Contact__c",recordId);
        component.set("v.newCntctMappingField.ContactType__c",component.get("v.cntctTypesMap")[mappingName]);
        component.set("v.newCntctMappingField.Name",mappingName);
        component.find("cnTypeRecordLoader").saveRecord($A.getCallback(function(saveResultContact) {
            if(saveResultContact.state === "SUCCESS" || saveResultContact.state === "DRAFT"){
                component.set("v.isOwnerDefined",'myTest');     // I have assigned string value to component attribute
                console.log('====' + component.get("v.isOwnerDefined")); // But here it returns "undefined"
                console.log('Contact Type mapping Saved!!');
            }
            else if (saveResultContact.state === "INCOMPLETE") 
                console.log('Server could not be reached. Check your internet connection!');
            else if (saveResultContact.state === "ERROR") 
                console.log('Exception Found!');
            else
                console.log('Error while loading Current Processor Picklist. Please contact your System Administrator.');
        }))
    }


Any Help?