function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Siddhant Shukla 16Siddhant Shukla 16 

parent relationship field returning null

I have a query as below:
WOD_2__Claim__c clm=[select id ,name,DTC_EngineSerialNo__c,DTC_Error__c, DTC_Engine_Mismatch__c, WOD_2__Inventory__r.Engine_Serial_Number__c from WOD_2__Claim__c where id=:claimid limit 1];
However when I debug clm.WOD_2__Inventory__r.Engine_Serial_Number__c is returning NULL.

The code runs in System mode. May I know why is this happeing
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi Sidhant,

Can you check the user has access to the WOD_2__Inventory__c records are sharing with the respective user or not.

Thanks!!
Casey ChristensenCasey Christensen
Thank you for sharing information. Game and music app ApkCima (https://apkcima.com/) is completely free
Siddhant Shukla 16Siddhant Shukla 16
You guyz were right. Although I had not used with/without sharing keyword in the class so I was under the imporession that the class would be running in System mode. However this was still running in With Sharing mode. The reason I felt is that My Aura Component was under a child to a Parent Comp- Claim_Base whose contoller was in with_sharing mode. Hence my controller had inherited the shairing. Thus the user did not had access over the Inventory record and hence the issue.