+ Start a Discussion
Santosh Reddy9989Santosh Reddy9989 

FLS check for lookup field in Lightning component Controller

Hi, This is santosh.
I am system adimistrator.
I have removed read access of  Account Name(AccountId) field from Contact Object. As shown in below image.
User-added image

I have used below the code for Lightning component controller.

global with sharing class GenericCmpController 
{

    @AuraEnabled
   public static DynamicBindingWrapper getRecords(String objectName,........... )
   {

     SObjectType childobje = Schema.getGlobalDescribe().get('Contact');
     
     system.debug('Field FLS = ' +  childobje.getDescribe().fields.getMap().get('AccountId').getDescribe().isAccessible());
    
     ....................................
     ....................................
   }
}

When  i check the debug log 

Field FLS = true 


If i run the same code  in developer console i am getting 

Field FLS = false ;

How did i get isAccessible() value True for AccountId , After mentioned "With sharing" in lightning controller  ?

Whyam I getting different results for developer console and Lightning controller (With sharing) ??
 
Please clarify.

Thanks,
Santosh Reddy