1

We have an aura component that is included on the lightning record page. it shows warning messages on certain conditions.

We are facing an error 'Cannot read properties of null(reading fieldname__c)' for a particular profile when the record page is loaded or when the user is navigating anywhere on that record.

  • We are using lightning data service tag force:recorddata in the aura component for accessing the data.
  • The error is coming for the following line where we are accessing the value of a field.
    var solProductValue = component.get("v.simpleRecord").fieldname__c;
  • We checked the object and field access for the profile and the user has the read access for that object and the mentioned field.
  • We are not facing the issue when we log in with the system administrator user.

We are not able to find the root cause. is this an access issue or code issue? Need help

3
  • How and where is this being set component.get("v.simpleRecord") Commented Aug 25, 2022 at 9:00
  • in the controller js file Commented Aug 25, 2022 at 9:41
  • I meant you will have to share the code. Commented Aug 25, 2022 at 9:56

1 Answer 1

0

Lightning Data Services are being run asynchronously.

I belive when compiler executes component.get("v.simpleRecord").fieldname__c; your component still has no response while onloading.

Data won't be there yet. Try to add recordUpdated attribute and from there call component.get("v.simpleRecord").fieldname__c;

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_handling_record_change.htm

If you want to learn more about lightning cache and how it works. check out this Dreamforce

You must log in to answer this question.

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