[SalesForce] How to fetch profileName and permssionSets assigned to the all active users based on profile name

Requirement:I need to fetch a data with username with profileName and permission Sets assigned to users based on profile.

Here I have written a Query for fetching user.
Below is the query

select  user.FirstName, user.profile.name FROM user where user.IsActive=true and  user.profile.name='Standard User'

Can anyone please modify the query so i will get all the users permission set assigned.

Best Answer

Please let me know if this works for you : SELECT count() FROM PermissionSetAssignment p WHERE p.PermissionSet.IsOwnedByProfile = false AND p.Assignee.Profile.Name = 'System Administrator'

Please mark this as best answer if it resolves your query.

Related Topic