Is there a way to get a profile's field level security? I tried an soql query for FieldPermissions object but it's based off of permission sets so if there's no permission set with at least read access on that field, it doesn't show up. However, I want all the fields on the profile itself.
-
1What you are trying to achieve? Is it just for documentation purpose, or ts for business use case?– Pranay JaiswalCommented Aug 26, 2019 at 18:55
-
Want to turn it into excel sheet to use– Peter LuoCommented Aug 26, 2019 at 18:58
-
Last time I did this, I wrote an Excel Macro. One API call to get all field names and generate columns/rows, then another to get the active fields, which populated the grid. It took a couple of days because I suck at VBScript, but overall wasn't too hard to accomplish. Sadly, I don't have the source for this any longer.– sfdcfox ♦Commented Aug 26, 2019 at 21:31
Add a comment
|
1 Answer
All Profiles have child permissionSets which are the parents of their field permissions. These links have a very good diagram and sample queries: PermissionSet object see also FieldPermission object
Here is a sample query that delivers all the child field Permissions. You just need to add the Profile name or ID to the WHERE clause:
SELECT id, SobjectType, Field ,ParentId , PermissionsEdit ,PermissionsRead, Parent.IsOwnedByProfile, Parent.Name,Parent.Profileid , Parent.Profile.Name
FROM FieldPermissions
WHERE Parent.IsOwnedByProfile = true
AND Parent.AND Parent.ProfileId = '...your Id here'
LIMIT 100