You need to sign in to do that
Don't have an account?
Rocks_SFDC
How to Display the user's list based on Permission
Hi Team,
I have a requirement where we just wanted to display the list of user's based on the permission we given.
Our input should be the permission name, then output should be the list of users those are having that permission.
Do we have any SOQL that supports this? or do we have any other workaround to display.
Thanks,
Anil
I have a requirement where we just wanted to display the list of user's based on the permission we given.
Our input should be the permission name, then output should be the list of users those are having that permission.
Do we have any SOQL that supports this? or do we have any other workaround to display.
Thanks,
Anil
In fact, there is: https://developer.salesforce.com/blogs/engineering/2012/06/using-soql-to-determine-your-users-permissions-2.html
Suppose you want to Show all Users with ViewAllData Permission,
try this below SOQL,
SELECT Id, AssigneeId, Assignee.Name, PermissionSet.IsOwnedByProfile
FROM PermissionSetAssignment
WHERE PermissionSet.PermissionsViewAllData = True
ORDER BY PermissionSet.IsOwnedByProfile DESC, Assignee.Name
This query will return all Users with Permission to View All Data, either acquired from Profile or from Permission Set. So based on the permission you assign, to can query all the users.
Regards,
Roshni
For General Permissions and Administrative permissions at profile level, I'm writing the SOQL Query on the profile.
Now, how can I pass the variable as string immediate to after where condition in SOQL Query.
It is something like as follows:
Select Id, Name from Profile Where 'OurString' = true;
Can you please post the dynamic SOQL that you have tried. let me check what went wrong.