How to query Permission Set License Assignments using Salesforce SOQL?

How to query Permission Set License Assignments using Salesforce SOQL?

Salesforce SOQL query can be used to find users who are assigned as part of Permission Set License Assignments.

Please check the following Sample SOQL which is used to find users who are part of the “Standard Einstein Activity Capture User” Permission Set License Assignments

Sample SOQL for “Standard Einstein Activity Capture User” Permission Set License Assignments:

SELECT Name, IsActive
FROM User
WHERE Id IN (
SELECT AssigneeId
FROM PermissionSetLicenseAssign
WHERE PermissionSetLicense.MasterLabel = 'Standard Einstein Activity Capture User'
)
ORDER BY Name

Output:

Sample SOQL for “Messaging User” Permission Set License Assignments:

SELECT Id, Name, IsActive
FROM User
WHERE Id IN (
SELECT AssigneeId
FROM PermissionSetLicenseAssign
WHERE PermissionSetLicense.MasterLabel = 'Messaging User'
)
ORDER BY Name

Output:

Leave a Reply