I want to know whether the field level security is assigned through profile or permission set through SOQL.
1 Answer
It can be assigned through both (they can overlap), but you can generally find out by performing a query:
SELECT PermissionsRead, PermissionsEdit
FROM FieldPermissions
WHERE Field = 'Account.Industry' AND
Parent.IsOwnedByProfile = FALSE
AND ParentId IN
(SELECT PermissionSetId
FROM PermissionSetAssignment
WHERE AssigneeId = :UserInfo.getUserId()
You can change the fields or queries in a variety of interesting ways, depending on exactly what you're trying to find out.
-
Why I'm getting unknown error parsing query. I'm unable to get this query work. Mar 16, 2022 at 6:17
-
1@LetMeCodeYou This has to be done in Apex. If you're using straight SOQL, you need to somehow retrieve the user Id first and plug that in to your query.– sfdcfoxMar 16, 2022 at 17:28