Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Automate Permisison Set assignment Process

    • Auto Add/Remove Permission Set – Part 1

      Posted at 3:41 AM by Rakesh Gupta, on August 14, 2014

      Permission Sets are helpful for providing a particular set of functionalities to a user in addition to the permissions provided to their Profile. For example, you may want to grant only a few of your sales users to convert leads or two-factor authentication access. In this case, rather than having a special sales profile with the convert lead permission or two-factor authentication permissions. You have to create a permission set with the lead conversion permission and assign it to a specific user. So most of the time you came around this situation mentioned below

      • Assign permission set to a user after 7 days from Today i.e.  21-Aug-2014 future date
      • Assign permission set for a specific time period 22-Aug-2014 to 30-Aug-2014 (Like you have defined start and end time)
      • Remove permission set from user on 31-Aug-2014 i.e. future date

      Note: – Remember Today is 14-Aug-2014.

      So what you will be done in these cases, wants’ to automate this process if yes then have a look at this article.

      Business Use Case

      Management in Universal Container wants to automate permission set assignment process so their admin workload will be reduced.

      Solution for the above business requirement

      In this article, I am going to discuss how to auto assign Permission Sets to a user and In the next articl I, will discuss about auto remove Permission Sets. First of all create few fields on the User object to save condition to auto assign Permission Sets to the user. In this demo I will create few fields on the User object as shown in the below screenshot

      Custom Fields on User object

      Custom Fields on User object

      To solve this requirement we will use Visual Workflow and Workflow Rule (i.e Headless Flow).  Before going ahead with the solution you have to understand about PermissionSetAssignment Object. It’s represents the association between a User and a Permission Set. Below are the key fields from PermissionSetAssignment object

      Field Name Details
      PermissionSetId ID of the PermissionSet to assign to the user specified in AssigneeId.
      AssigneeId ID of the User to assign the permission set specified in PermissionSetId.

      To develop this application follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
      2) Click on New Flow, it will open flow canvas for you. Create Two Text type variable UserID (To pass User ID) and PermissionsetID (To pass permission set ID )
      3) Drag and drop a Record Create ( Give the name Assign Permission Set) onto the window to assign permission set to user and map the fields according to below details

      • Select Object PermissionSetAssignment
      • AssigneeId=  {!UserId}
      • PermissionSetId= {!PermissionSetID}, You can take help from the following screenshot
      Assign Permission Set

      Assign Permission Set

      4) Finally our Flow will look like the following screenshot

      Auto Add Permission Set to User

      8) Save the flow with name Add Permission Set and close the canvas.

      Create Workflow rule to fire our Flow

      Our next task is to create a workflow on the User object on creation and every time it’s edited event. To create a workflow on the User object follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
      2) Select object  User from the drop-down
      3) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time dependent workflow), For Rule Criteria select From Date != False  and  Start= False as shown in the following screenshot

      Workflow Rule1

      Workflow Rule1

      4) Now Add a time trigger to  to set Start flag True after 1hr of From Date. To do this click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, I selected 1hr after the From Date. Now add one field update action for time dependent workflow and set Start flag to True. You can take help from the following screenshot

      Time based action

      Time based action

      5) Save the workflow and activate it.
      6) Create another workflow (i.e. workflow Rule2 ) on the same object to fire our Flow, set entry criteria of trigger is Start= True

      Workflow Rule2

      Workflow Rule2

      7) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow (Add Permission Set) and set Variable (UserID and PermissionSetID) value as shown in the following screenshot

      New Flow Trigger Action

      New Flow Trigger Action

      8) Add one Immediate Workflow Actions i.e. New Field Update and Set Start flag to False.
      9) Save the workflow and activate it.

      It’s time to test this feature

      1) Go to the User’s detail page to whom you want to assign Permission Sets and fill the detail. In this demo I am going to assign Permission Sets with Name “Test“,  it will look similar to below screenshot

      Permission Set Assignment Detail

      Permission Set Assignment Detail

      2) To check time dependent workflow queue Follow the path, Click on Name | Setup | Administration Setup | Monitoring | Time–Based Workflow and search the queue

      Time-Based Workflow Queue

      Time-Based Workflow Queue

      3) Below is the Proof of concept for your reference

      Proof of Concept

      Auto Add/Remove Permission Set – Part 2

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Salesforce Flow, User Management | 10 Comments | Tagged Add Permisison set to user, Add permission set, Add permission sets to user, ADM 201, adm 201 certification, adm 201 salesforce, Advance flow, Assign Permission Set based on start time, Assign Permission Set based on time period, Auto add Permission Sets in Salesforce to user, Auto Add/Remove Permission Set, Auto assign Perission set on future date, Auto assign permission set, Auto assign permission set in future date, Auto assign permission set in past date, Auto assign permission sets, Automate Permisison Set assignment Process, Cloud Flow, Cloud Flow Designer Workbook, Con 201, dev 401, DEV401, flow, Flow Designer, Flow examples, Flow exmple, Flow Triggers For Workflow, FlowRockstar, FlowTrigger, FlowTriggerPilot, FlowX Flow Triggers, headless flow, Headless Flows, New Flow, Permission Set auto assign, Permission Set Auto Assignment, Permission Sets auto asisgnment, Permission Sets Auto Assignmen, Permission Sets in Salesforce, PermissionSetAssignment, PermissionSetId, Record Create, Salesforce Flow, Screen, screenshot, Sp14FlowHackathon, Trigger Flow, Trigger ready flow, Visual flow, Visual Work Flow, Visual workflow, Visual workFlow examples, Visual Workflow Flow Cloud Flow Designer, Visual Workflow Implementation Guide, Visualforce page, workflow rule
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Streamline Data Collection with Salesforce-Connected Forms
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Learning Flow
    • Learning Process Builder
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Process Builder - Part 1 (Automatically Create a record)
    • Getting Started with Salesforce Flow – Part 4 (Need to Redirect a User to a New Record?)
    • Getting Started with Salesforce Flow – Part 41 (Create a Survey Using Flow? Why Not?!)
    • Add Record to Multiple Chatter Groups - Parsing Multi-Select Picklist fields (Flow)
    • Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows)
    • Getting Started with Salesforce Flow – Part 31 (Auto Submit Record into Approval Process with Flow)
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub