1

I'm new to SOQL. I'm trying to write a SOQL query to get me all the users associated with a permissionset. For that I can just query the PermissionSetAssignment object. However, I'd like to have some specific filters in the WHERE clause relating to the assigned users and only return those users satisfying the filter. I can't seem to wrap my head aound how to do this.

An example can be, all the users associated with PermissionSet1 or 2 and the user was created after specidic date and his manager is John.

Thanks for helping out! Eran

1 Answer 1

1

Try something like this:

select Id, Assignee.Name, PermissionSet.Name 
  from PermissionSetAssignment 
  where PermissionSet.Name IN ('Foo','Bar') and
        Assignee.CreatedDate > LAST_YEAR and
        Assignee.Manager.Name = 'John'

The useful bits are:

  • Relationship name from PermissionSetAssignment to PermissionSet is PermissionSet.
  • Relationship name from PermissionSetAssignment to User is Assignee
  • Relationship name from User to User (manager) is Manager

SOQL Reference on relationship names

You must log in to answer this question.

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