I have the exact same component in 2 different sandboxes. The component uses lightning:recordEditForm and is passed an object name & Id. There is a lookup field to the Account object that is supposed to display as an output field in the form. I'm getting 2 different outcomes on page load..

Org A: When the component's recordEditForm loads, the Account loads and the __r related record also loads. I can see this by debugging the event params onload of the form, like this

enter image description here

Org B: The exact same component, in the exact same context, loads the Account field, but DOES NOT load the __r related record. So what I'm left with is a blank output on the Account field in the UI.

enter image description here

As you can see, the __r JSON does not load, so the form doesn't display the Account Name in the form.

I'm a sys admin in both orgs, with Modify All & CRUD access to Account object & the base object I'm working with - so it's not FLS or anything like that. Can anyone help explain why this would load in one context but not another?

EDIT for more context: Also in looking at what the recordEditForm is loading, I can see the objectInfos is not loading the Account object either..

Org A:

enter image description here

vs Org B:

enter image description here

Again - I have full read/write/modify all access to all objects & fields in both orgs...

  • What's the difference between ORG A and ORG B? Was one more recently refreshed, is work done primarily first in one over the other, etc. – Kris Goncalves Oct 25 '19 at 14:40
  • Few questions just to eliminate some possibilities: do the components have same API version in both orgs ? and do the fields loaded within the component, have data in them in org B ? – Shamina Oct 25 '19 at 14:43
  • 1
    it's a shortcoming of the documentation. they fail to mention Field Accessibility anywhere in the docs. See the answer I posted below. – Jason Benkert Oct 25 '19 at 14:51

So I figured this out. recordEditForm upholds not only FLS, but also "Field Accessibility". So in this case the standard Page Layout for the record I was editing did not have the Account field on it. Therefore the recordEditForm would not load the field's data.

enter image description here

The documentation mentions nothing about accessibility, only FLS.

"This component also takes care of field-level security and sharing for you, so users see only the data they have access to."

I consider this field accessibility restraint a bug more than a feature...

  • 1
    +1. This is a good information. I think this could be either a bug or missed documentation. Good to highlight this to Salesforce. – Jayant Das Oct 25 '19 at 17:38
  • @JayantDas the behavior is indeed strange but there exist an article documenting this, refer to my answer – Shamina Oct 25 '19 at 17:51
  • @Shamina That is definitely the issue here. Thanks for pointing out that in the docs. – Jayant Das Oct 25 '19 at 17:53

Here's the link to the documentation which mentions this:

When using Lookup Field in lightning:recordEditForm, the field value may not show the existing data. This is because the lightning:inputField is currently populated only when the field is added to Page Layout.

  • 1
    Thanks @Shamina. I'm still convinced that this information should be included in the actual documentation for the component and not in a knowledge article. – Jason Benkert Oct 25 '19 at 23:44

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.