Here is the way to fetch field permission details for all profiles in SOQL query by using FieldPermissions object.
Query specific field permission for all Profiles:
PermissionsRead --> View permission for the field.
PermissionsEdit --> Edit permission for the field.
The below approach also works but the profile name will be displayed as [Object Object] in Query Editor,
Reference:
Field Permission
Object Permission
Query specific field permission for all Profiles:
- SELECT Profile.Name FROM PermissionSet WHERE IsOwnedByProfile = TRUE AND Id IN (SELECT ParentId FROM FieldPermissions WHERE FIELD ='Payment__c.Firm__c' AND SobjectType = 'Payment__c' AND PermissionsRead = TRUE AND PermissionsEdit = FALSE) ORDER BY Profile.Name
PermissionsRead --> View permission for the field.
PermissionsEdit --> Edit permission for the field.
The below approach also works but the profile name will be displayed as [Object Object] in Query Editor,
- SELECT Parent.Profile.Name FROM FieldPermissions WHERE FIELD = 'Payment__c.Firm__c' AND Parent.IsOwnedByProfile = TRUE AND SobjectType ='Payment__c' AND PermissionsRead = TRUE AND PermissionsEdit = FALSE ORDER BY Profile.Name
Reference:
Field Permission
Object Permission