1

According tot he documentation, lightning:inputfield should work for checkbox type field.

Here is a snapshot of the code we have:

<aura:attribute name="dealershiptTeamRecord" type="IMP_Dealership_Team_Info__c" /> 

<force:recordData aura:id="recordHandler"
                      recordId="{!v.recordId}"
                      targetFields="{!v.dealershiptTeamRecord}"
                      recordUpdated="{!c.handleRecordChange}"
                      mode="EDIT"
                      fields="IMP_Team_Closed_Friday__c"
/>

<lightning:recordEditForm aura:id="recordViewForm"
    recordId="{!v.recordId.Id}"
    recordTypeId="{!v.recordId.RecordTypeId}"
    objectApiName="IMP_Dealership_Team_Info__c"
    onload="{!c.handleRecordChange}">

        <lightning:inputField   fieldName="IMP_Team_Closed_Monday__c" 
                                value="{!v.dealershiptTeamRecord.IMP_Team_Closed_Monday__c}" />
</lightning:recordEditForm>

Where IMP_Team_Closed_Monday__c is a checkbox field type,

In our case, the form, when saved, always sets the value to false not matter what the checkbox in the UI is set.

1

Your <lightning:recordEditForm> isn't receiving the correct sObject Id.

recordId="{!v.recordId.Id}"

should be

recordId="{!v.recordId}"
  • Thanks for the reply. It was a mistake, but that was not the issue. I have other inputFields on the form which work just fine, but not the checkbox type. I checked the permissions on the field, but nothing stands out. – user1786037 Jan 25 at 13:19
  • I'm having a hard time seeing how your form works at all without the sObject Id set correctly. Can you provide a working reproduction? – David Reed Jan 25 at 13:30
0

Try using lightning:recordForm in edit mode, without layout type and specifying only that custom field in fields attribute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.