1

I want to know whether the field level security is assigned through profile or permission set through SOQL.

1
  • 1
    if field is accessible and profile does not have it set then it has to be via perm set
    – Eric
    Jan 30, 2017 at 4:26

1 Answer 1

2

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.

2
  • 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.
    – sfdcfox
    Mar 16, 2022 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .