If you're using Formstack's Experience Cloud forms (Formerly known as Community Forms), then you may know that every new experience user (formerly known as community user) needs to have the Formstack Experience Forms permission set. This permission set grants access to the objects, pages, code, and components that are needed to power the experience 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.
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 profile or a custom profile that you have created for your experience site.
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 experience site User profile that is being assigned to users in your experience cloud site.
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.
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
Hit Done
Your flow should look like this:
Add the Get Records element
Label: Get Experience 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:
Hit Done
Draw a connection between the Start step and the Get Records step
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}
Click Done
Draw a connection between the Get Records step and the Decision
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}
Click Done
Draw a connection between the Decision and Create Record step
Save your flow
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.
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/