Auto-Assigning Community Permissions With Flows

If you're using Formstack's Lightning Community forms, then you may know that every new community user needs to have the Formstack Community Forms permission set. This permission set grants access to the objects, pages, code, and components that are needed to power the community form. Assigning this permission set to each new user can take time if you're doing it manually. This article will show you how to set up an automation process with zero Apex that will auto-assign this permission set to every new user who joins your community.

Getting the Profile ID

Before you get started on creating a Flow, you will need to get the ID of the profile that we will use in the flow. It may be the out-of-the-box Salesforce community profile or a custom profile that you have created for your community.

The Salesforce guide for retrieving the ID of a profile can be found here:
https://help.salesforce.com/articleView?id=000312782&type=1&mode=1

First, go to Setup > Users > Profiles. Find the Community User profile that is being assigned to users in your community. 

mceclip0.png

Click on the profile's Name to see the profile's detail page. Retrieve the profile's ID using the instructions outlined in the Salesforce guide. Record this ID as we will need it for the first step of your Flow.

 

Creating the Flow

Got to Setup > Process Automation >Flows  and then select New Flow.

Select Record-Triggered Flow, hit Next, and then select Freeform.
mceclip0.png


Trigger Flow When - A record is created
Run the Flow - After the record is saved

Click on Choose Object
Select the User object

We're going to set up two conditions.

Condition Requirements - All Conditions Are Met (AND)
1 - IsActive Equals {!$GlobalConstant.True}
2 - ProfileId Equals (The ID of the Profile from Step 1 of this article)

Your final object conditions should look like this, but with your Profile ID

mceclip1.png

Hit Done

Your flow should look like this:
mceclip1.png

Add the Get Records element

Label: Get Community Permission Set
API Name: should auto-fill
Object: Permission Set

Condition Requirements - All Conditions Are Met (AND)
1 - Name Equals Community_Regular_Permissions
2 - NamespacePrefix Equals VisualAntidote

Sort Order
Not Sorted

How Many Records to Store - Only the first record
How to Store Record Data - Automatically store all fields

This is how this element should look:
mceclip3.png

Hit Done

Draw a connection between the Start step and the Get Records step


mceclip4.png

Add the Decision element

Label: Permission Set Exists
API Name: should auto-fill

In the Outcome section
Label: Yes
Outcome API Name: should auto-fill
Condition Requirements - All Conditions Are Met (AND)
1 - {!Get_Community_Permission_Set.Id} Is Null {!$GlobalConstant.False}

mceclip3.png

Click Done

Draw a connection between the Get Records step and the Decision
mceclip5.png

Add the Create Record element

Label: Assign Community Permissions
API Name: should auto-fill

How Many Records to Create: One
How to Set the Record Fields: Use separate resource and literal values

Object - Permission Set Assignment
Set Field Values for the Permission Set Assignment:
AssigneeID - {!$Record.Id}
PermissionSetId - {!Get_Community_Permission_Set.Id}


mceclip4.png
Click Done

Draw a connection between the Decision and Create Record step

mceclip7.png

mceclip8.png

Save your flow

mceclip5.png

Activate
your flow. That's it, you're all set.

Final Notes

Once you have activated the flow, you should be able to test it by creating a new community user. Once you have created that user, you can check their user detail page to see if the Formstack Community Forms permission has been automatically assigned.

If you have multiple different community user profiles, you can modify the "Start" step of this flow to account for those profiles. Instead of filtering by a single profile ID, you can use custom condition logic to allow for any number of profiles.
mceclip9.png

If you are using dynamic prefill, you can also create a different version of this flow to automate assignment of the "Formstack Utility Permissions" to your internal users. You would change the target profile ID values as well as the Permission Set Name in the "Get Records" step.

Finally, this guide was based on an existing guide found here:
https://automationchampion.com/2020/11/26/automatically-add-permission-sets-to-new-user/

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.