Big Idea or Enduring Question:
Want to quickly create a new user by cloning an existing user with Public Group, Queue, and Permission Set?
To Clone a record means to replicate it. Salesforce provides an out-of-the-box feature to clone object records – thereby, saving time and enhancing productivity. Generally, if someone wants to clone an Account with an Opportunity they would opt for an Apex Trigger But, we know better! Oh, Ya!
Salesforce provides ‘Clone with Related‘ action. The action makes it simple to create recurring Opportunities and Ca
In the past, I have written a few articles on automating User creation pre and post-process. Why not check them out while you are at it?!
- Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
- Getting Started with Process Builder – Part 19 (Automatically Add New User to Public Group or Queue)
- Getting Started with Process Builder – Part 28 (Auto Freeze Users Account)
- Getting Started with Process Builder – Part 43 (Auto Assign package license to New user)
- Getting Started with Salesforce Flow – Part 36 (Automatically Add New Users to a Chatter Group)
- Getting Started with Salesforce Flow – Part 50 (Welcome New Users by Default – Auto Follow them in Chatter!)
- Getting Started with Process Builder – Part 22 (Discover How to Auto Populate Delegated Approver Field on a New User Record!)
Objectives:
After reading this article, you will be able to:
- Use Flow to deep clone User with Public Group, Queue membership, and associated Permission Sets
- Understand the difference between a Permission Set that is owned by a User (User created) and a permission set that is owned by a Profile (System generated)
- Learn how to use a Decision element to find whether a Record variable or a Record collection variable, contains a record
- Find out how to use the Loop element to create multiple records (or clone records)
- And, last but not least, discover how to use the Create Records element to create multiple records at once (Bulk Safe)
Business Use Case
Steven Greene, a Lead System Administrator at Universal Containers (UC), received a requirement to create an automation that would allow System Administrators to quickly create users by cloning an existing user. In addition, the solution should also allow the Administrators to clone public group and queue memberships including associated permission sets.
To get started we will copy the following fields from an existing User‘s Record:
- TimeZone
- Language
- Locale
- Profile
- Role
- UserLicense
- Email Encoding
- Manager
Allow System Administrators to populate the following fields:
- First Name
- Last Name
- Username
- Alias
- Nickname
Steven envisioned the new Flow screen similar to the following screenshot:
Automation Champion Approach (I-do):
While this can be solved using various automation tools like Apex, etc, we will use Screen Flow.
Before proceeding, you have to understand the PermissionSet objects in Salesforce. It represents an association between a User and a PermissionSet. There are two types of Permission Sets:
- Permission Set that is Owned by User (User created).
- Permission Set that is owned by Profile (System Generated) – Every profile is associated with a permission set that stores the profile’s user, object, and field permissions, as well as setup entity access settings. Permission sets that are owned by profiles can be queried but not modified.
By default, every user will be assigned to a Permission Set that is owned by the Profile, and this Permission Set will not be visible in the User Interface. If you query the Read the rest of this entry!