Assign Permission Set at the User Creation Made Simple: What You Need to Know | Salesforce Guide
Step 1: Create a Permission Set
- Click Setup.
- In the Quick Find box, type Permission Sets.
- Select Permission Sets, then click New.
- Label the Permission Set then press the tab key, the API Name will auto-populate.
- Click Save.
Step 2: Create a Record- Triggered Flow to Assign Permission Set at the time of User Creation
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows, then click New Flow.
- Select the Record-Triggered Flow.
- Click Create.
Don't forget to check out: Permission Sets in Salesforce - Learn About Its Different Types
Step 3: Configure the Flow as Follows
- Trigger the Flow When: A record is created
- Run Flow: A record is created
- Object: User
- Set Entry Conditions
- Select All Conditions Are Met (AND)
- Set Conditions
- Field: User | IsActive
- Operator: Equals
- Value: {!$GlobalConstant.True}
- Click Done.
Step 4: Adding a Get Record Element to Find Permission Set Id
- Under Toolbox, select Element.
- Drag-and-drop the Get Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Select the Permission Set object from the dropdown list.
- Select All Conditions Are Met (AND).
- Set Filter Conditions
- Row 1
- Field: Name
- Operator: Equals
- Value: Tetsing_User
- Row 1
- How Many Records to Store:
- Select Only the first record
- How to Store Record Data:
- Choose the option to Automatically store all fields.
- Click Done.
Check out another amazing blog by Aman here: Knowledge of Salesforce Flow and Different Types of Flows and Its Elements
Step 5: Create Records – Add Permission Set to New Users
- Under Toolbox, select Elements. Drag and drop Create Records onto the canvas.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources and literal values
- Object: PermissionSetAssignment
- Set Field Values for the Permission Set Assignment
- Row 1
- Field: AssigneeId
- Value: {!$Record.Id}
- Click Add Row
- Row 2
- Field: PermissionSetId
- Value: {!Find_Permission_Set_Id.Id}
- Click Done.
- If you want to Remove Permission Set from the Assigned User then you will need to set the Expiration Date.
- Create the Variable.
- Set the Variable type Formula.
- Set the API Name date.
- Select Data Type as Date/Time and Set the Formula of the Expiration Date NOW() + Adding No of Days according to the requirement.
- Row 2
- Field: ExpirationDate
- Value: {!date}
In the end, Flow will look like the following screenshot:
Perform the steps below:
- Click Save.
- Enter the Flow Label the API Name will auto-populate.
- Click Save.
Responses