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
Santosh Reddy9989Santosh Reddy9989 

how to check the FLS of parent object's field in Child to Parent query ?

Hi,

query : Select Id, Name, Email, Account.Name, Account.Industry from Contact


For Id, name and Email fields, we use below code for FLS check

 SObjectType childobje = Schema.getGlobalDescribe().get('Contact'); 
 childobje.getDescribe().fields.getMap().get('Name').getDescribe().isAccessible();
 childobje.getDescribe().fields.getMap().get('Email').getDescribe().isAccessible();


if i use childobje.getDescribe().fields.getMap().get('Account.Industry').getDescribe().isAccessible() then i am getting "NullPointerException de-reference a null object" exception.

How to check the FLS for Account.Industry from contact object ??????? 

Thanks,
Santosh Reddy
Raj VakatiRaj Vakati
Juts use like this

childobje.getDescribe().fields.getMap().get('Industry').getDescribe().isAccessible() 
Santosh Reddy9989Santosh Reddy9989
Industry is a field of Account.