Categories
Salesforce

SOQL to find All Users with a Custom Permission

Trova l’id di un dato custom permission in base al suo name

SELECT ParentId 
        FROM SetupEntityAccess 
        WHERE SetupEntityId IN (
            SELECT Id 
            FROM CustomPermission 
            WHERE DeveloperName = :name
        )

Trova gli utenti con un certo custom permission settato

SELECT Username FROM User WHERE Id IN (
            SELECT AssigneeId FROM PermissionSetAssignment
            WHERE PermissionSetId = 'id custom permission'
        )

Leave a Reply