0

We have been using this code for several years without issue however we have suddenly come across an issue this week. Here is the code:

<aura:attribute name="objectFields"
                type="Object"
                access="private"
                description="Used to reference a record fields in component markup."/>
<force:recordData aura:id="fieldUpdate"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetFields="{!v.objectFields}"
                      targetError="{!v.fieldUpdateError}"
                      recordUpdated="{!c.recordUpdated}"
                      mode="EDIT"/>

In the Javascript I have tested many fields, some are updateable and some aren't. What is causing the ones to not be updateable?

Here is a sample of what I have found:

component.set('v.objectFields.Min_Decision_Days__c', 123) - undefined

component.get('v.objectFields.Min_Decision_Days__c') - undefined

component.set('v.objectFields.Geolocation__Latitude__s', 51) - undefined

component.get('v.objectFields.Geolocation__Latitude__s') - undefined

component.set('v.objectFields.Source_Percentage__c', 23) - undefined

component.get('v.objectFields.Source_Percentage__c') - 23

component.set("v.objectFields.Name", 'TEST/123') - undefined

component.get("v.objectFields.Name") - TEST/123

4
  • I would assume the permissions for the contextual user have changed.
    – Phil W
    Commented Mar 15 at 6:58
  • I thought it might be that but I am testing it using System Administrator and have tried manually editing those fields myself and it's fine.
    – fred
    Commented Mar 15 at 10:11
  • 1
    Just remember that even Sys Admin needs to have permissions for fields - this is often automatically added, but not always. That said, your second part that it works through the standard UI makes this unlikely the issue.
    – Phil W
    Commented Mar 15 at 11:40
  • 1
    Found the issue! The field has to be on the page layout
    – fred
    Commented Mar 15 at 14:38

1 Answer 1

1

When using force:recordData, you can only update fields that are on the record's page layout (or compact layout if layoutType is COMPACT).

Adding the field to the page layout will solve this issue.

(The reason we have recently had this issue is because we started using Dynamic Forms)

1
  • 1
    Yeah, so many things still need the page layout even when you have dynamic forms... some serious gaps to be filled...
    – Phil W
    Commented Mar 15 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .