4

I would return the Name of the User in PermissionSetAssignement for a specific PermissionSet. Here is my code:

SELECT Name 
FROM User 
WHERE Id in (SELECT AssigneeId 
             FROM PermissionSetAssignment
             WHERE PermissionSetId in (SELECT Id 
                                       FROM PermissionSet 
                                       WHERE Name like 'Project_Pulse_PM_Mind'
                                       )
             )

This is the error that it returns:

    MALFORMED_QUERY:
PermissionSetId in (SELECT Id FROM PermissionSet WHERE Name like 'Project_Pulse_PM_Mind'))
^
ERROR at Row:1:Column:124
Nesting of semi join sub-selects is not supported

Someone know I could resolve?

4

You can't nest 2 or more sub-selects, indeed. But you can reference fields from parent objects in your query. So change it to:

SELECT Name from User where Id in (SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSet.Name like 'Project_Pulse_PM_Mind')

Also if you are filtering for an exact permission set name, consider changing the 'like' to an equals ('=') as that will normally give better query performance.

SELECT Name from User where Id in (SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSet.Name = 'Project_Pulse_PM_Mind')
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.