You need to sign in to do that
Don't have an account?
SOURAV GUHA 9
Automation using Flow/Apex
I have a list of permission sets (PS1-10) and one profile. Below are the steps which I need to execute:
Thank you
- First I need to find the users who have this particular profile and PS7.
- Then I need to check if the users having PS7 and this profile have all the permission sets (PS1-10) assigned to them.
- If there are less permission sets assigned, then return Missing, if there are more permission sets assigned, return Additional, else return No Change. I need to implement this using either Flow or Apex.
- The final output should give me the userID, the permission sets assigned to them and Missing/Additional/No change
Till now I have been doing this manually by querying the PermissionSetAssignment object, then retrieving the Assignee details and the permission sets assigned to the assignee, then manually checking.
Thank you
Please check the below logic and let me know if this help. You may need to change the profile name as per you requirement or permission set names.
I categorize the return this way
Let me know if this help or you need to understand the code.
All Answers
The part I am confuse is return Additional
What that means?
The way I understood the requirement is this
- First find the users who have a particular profile and also exist in PS7 Permission Set.
- Check the above users if these users are also assigned to the permissions sets (PS1-10)
- Find the users who are missing permission sets, all permission sets.
Now what do you mean by additionalExamples would help
Thanks
Thanks
Thanks
Please check the below logic and let me know if this help. You may need to change the profile name as per you requirement or permission set names.
I categorize the return this way
Let me know if this help or you need to understand the code.
Thanks a lot for the code. Would you mind providing an elaborate explanation for the logic, it would help a beginner developer like myself to grasp the concepts.
Thanks again.
Is the code doing what you are looking for, If yes can you please mark it a best Answer.
Here is the explanation.
- The first SOQL is to get the relevant users that are part of the profile and PS7
- Second SOQL is to get all the PermissionSets assigned to the above users order by user and ther permissionssets
- Then I loop around them looking the level of permissionset matching them against the required ones making a decision of those four scenarios mentioned above.
- I stored the results in the map by userid, list of permission set, status.
- I used the inner class to store the results
I hope this will help