In this article we will create a SOQL to get List of Users based on Certain Permission set.
Scenario : Get all users with 'ABCD' License but NOT assigned with Permission Set called 'EFGH'
To achieve this requirement we can use a SOQL query as below :
1 2 3 4 5 | Select Id, Name, Profile.UserLicense.Name From User WHERE Profile.UserLicense.Name = 'ABCD' and Id IN (SELECT AssigneeId FROM PermissionSetLicenseAssign WHERE PermissionSetLicense.MasterLabel !='EFGH') AND IsActive=true ORDER BY Name |
If you have any question please leave a comment below.
If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !
Thanks
Keep Coding
0 Comments