Assign Permission Set at the User Creation


Step 1: Create a Permission Set

  1. Click Setup.
  2. In the Quick Find box, type Permission Sets.
  3. Select Permission Sets, then click New.
  4. Label the Permission Set then press the tab key, the API Name will auto-populate. 
  5. Click Save.
Create Permission Set for Assign Users

Step 2: Create a Record- Triggered Flow to Assign Permission Set at the time of User Creation.

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows, then click New Flow.
  4. Select the Record-Triggered Flow. 
  5. Click Create.
Select the Record Triggered Flow

Step 3. configure the flow as follows:

  1. Trigger the Flow When: A record is created
  2. Run Flow: A record is created
  3. Object: User
  4. Set Entry Conditions
  5. Select All Condition Are Met (AND)
  6. Set Conditions
    1. Field: User | IsActive
    2. Operator: Equals
    3. Value: {!$GlobalConstant.True}
  7. Click Done.
Get Newly Created Active User

Step 4: Adding a Get Record Element to Find Permission Set Id:

  1. Under Toolbox, select Element
  2. Drag-and-drop Get Records element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Select the Permission Set object from the dropdown list.
  5. Select All Conditions Are Met (AND)
  6. Set Filter Conditions
    1. Row 1:
      1. Field: Name
      2. Operator: Equals
      3. Value: Tetsing_User
  7. How Many Records to Store:
    1. select Only the first record
  8. How to Store Record Data:
    1. Choose the option to Automatically store all fields
  9. Click Done.
Get Permission Set to Assign Permission for User

Step 5: Create Records – Add Permission Set to New Users

  1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
  2. Input the following information:
    1. Enter Label the API Name will auto-populate.
    2. How Many Records to CreateOne
    3. How to Set the Record FieldsUse separate resources, and literal values
    4. ObjectPermissionSetAssignment
    5. Set Field Values for the Permission Set Assignment
    6. Row 1:
      1. FieldAssigneeId
      2. Value{!$Record.Id}
    7. Click Add Row
    8. Row 2:
      1. FieldPermissionSetId
      2. Value{!Find_Permission_Set_Id.Id}
  3. Click Done.
  4. If you want to Remove Permission Set from the Assigned User then you will need to set the Expiration Date.
  5. Create the Variable.
  6. Set the Variable type Formula.
  7. Set the API Name date.
  8. Select Data Type as Date/Time and Set the Formula of the Expiration Date NOW() + Adding No of Days according to the requirement .
  9. Row 2:
    1. FieldExpirationDate
    2. Value{!date}
Assign Permission Set to User
Set Expiration Date in the Permission Set to remove from User

In the end, Flow will look like the following screenshot:

perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Save

Comments

Popular posts from this blog

Deployment on production Environment in salesforce

Easy way to Integrate Salesforce CLI with Visual Studio code

What is Multi-factor Authentication (MFA)? When and How to Use it? | Salesforce Developer Guide