Using Flow To Assign Permission Set Groups

Are you having to assign new Users their respective Permission Set Groups every time they’re created or change roles, when you have more important things to be doing, like reading SFDXHours? Then this article should give you enough guidance on automating this process. ‍In this article, I’ll guide you through a solution that automates the […]

0

Are you having to assign new Users their respective Permission Set Groups every time they’re created or change roles, when you have more important things to be doing, like reading SFDXHours? Then this article should give you enough guidance on automating this process.

In this article, I’ll guide you through a solution that automates the assigning of Permission Set Groups to newly created Users through the use of Flow Builder, now this can be improved and modified to perform better in certain scenarios… and one change I would recommend doing in a Live environment is to change this into an Invocable Flow and invoke it from some sort of User After-Save Master Flow to align with Salesforce’s new guidance on Flow builder.

To try and make this solution slightly easier to visualize, you can refer to the Flow Chart below.

Business Use-Case
John Doe, for Universal Containers, is wanting to automatically assign the Sales Team Permission Set Group to User records when they’re first created.
Build
So presuming you already have all of your Permission Sets & Groups setup, we’re going to dive straight into the Flow. In this example, we’re going to use a new Record-Triggered Flow. It will be based on the User object, and triggered when A record is created. The only entry criteria we are going to have is IsActive = True.

We are then going to add a new Get Records element. Inside here, we’re going to search for the object Permission Set Group where the DeveloperName = Sales Team. We’re going to only store the first record and store all fields.

We’re then going to add a decision in, for belts and braces. All we’re doing in this is checking to see if the previous getRecords ID is not Null. If it is Null, then it failed to find a Record and this will prevent the Flow from producing an error.

If the record was successfully found, then we’re then going to move into our final element of the flow, our Create Records element. This is what creates the tie between the User & the Permission Set Group and ultimatley ‘assigns’ the Permission Set Group to the User. The Object for which we’re creating a Record is the Permission Set Assignment Object, and the only 2 fields we’re going to set are the AsigneeId (ID from the User triggering the Flow) & the PermissionSetGroupID (ID from our getRecords element).

Your final Flow should look something similar to this:

Summary
This article should take you a step in the right direction when it comes to automating the User onboarding process, I’d love to hear your feedback below on how this solution could be improved on even more, or if you’ve taken this away and used it yourself!
Cameron Ofoluwa
WRITTEN BY

Cameron Ofoluwa

22 Year Old Salesforce Developer @ Pogust Goodhead & Founder of SFDXHours.

Leave a Reply

Your email address will not be published. Required fields are marked *