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
Abilash Kosigi 8Abilash Kosigi 8 

Retrieving Field Level Securities of a profile in a query

Is it possible to query the field level securities associated with a profile?

Please let me know
SarfarajSarfaraj
Profile settings is a Metadata. So you cannot query it. However you can get this metadata programmatically. 

https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_profile.htm

--Akram
Evan KennedyEvan Kennedy
You don't need to query the profile if you're just checking to see if the current user has field-level permission.

Take this example:
 
Account.SObjectType.getDescribe().isCreateable();

This tells you true if the current user has the ability to create accounts.

For field-level:
 
Account.SObjectType.getDescribe().fields.getMap().get('My_Field__c').getDescribe().isCreateable();

This tells you whether the "My_Field__c" field on the Account is createable for the current user.

Hope that helps.

 
Abilash Kosigi 8Abilash Kosigi 8
Hi,
Thanks for your replies.
My requirement is to fetch the field level security data of all the profiles in the org. Please let me know your suggestions.

Thanks,
Abhi