Skip to content
Skip to content
SalesforceFox

SalesforceFox

Easy way Learning & Exploring Salesforce !

  • Home
  • All Blogs
  • How To
  • Tips & Tricks
  • Salesforce Quiz
  • Resources
  • About
How to Clone a User in Salesforce : Deploy screen flow solution to your sandbox with few clicks by SalesforceFox.com

How to Clone a User in Salesforce : Deploy screen flow solution to your sandbox with few clicks.

Piyush LakhaniDecember 9, 2024March 29, 2025

Cloning a user can be great way to save time and automate repetitive task of replicating user’s profile, role, title and other user attributes. Currently, Salesforce does not provide any out-of-box feature to clone user.

In this blog, you will find a easy solution to clone a user via screen flow and how to deploy this flow to your org with few clicks.

Table of Contents
[Open][Close]
  • What user details will be cloned ?
  • Step by Step guide to build Clone User Screen flow
  • See Clone User in Action
  • How to Deploy this Flow to your Sandbox

What user details will be cloned ?

This Screen flow takes care of copying key fields such as:

  • Profile
  • Title
  • Role
  • Time Zone
  • Language

Additionally, User can also select to copy :

  • Manager
  • Permission Set & Permission Group
  • Permission Set License Assignment
  • Public Groups & Queue Membership
  • Locale
  • Company
  • Department
  • Division

Step by Step guide to build Clone User Screen flow

In order to understand this flow easily, we will break down this flow into 6 parts.

Now, Let’s go through each part one by one, to understand it thoroughly.

Part-1 :

How to Clone user via Screen Flow-1

We are launching this screen flow from custom link button on User record details via flow URL (covered in Part-6)

First, using existing user’s Id taken from button URL, get all details of existing user using Get Records element..

After this, using screen inputs element, capture all essential and unique information of a user (which we can’t clone).

Clone User Flow Input Screen

After capturing, these essential user inputs and what to clone additionally, we will create one new user record variable ‘newUserRec’.

Using assignment element, assign user information to this variable and insert it using create element record to create new user.

So far, Flow has cloned and inserted new user with all cloned user details including captured via screen inputs.

In next parts, we see how to clone additional details, Like Public Groups, Permission Set/Group and so on.

Part-2 :

How to Clone user via Screen Flow-2

In this part, we will cover how to clone user’s Public groups and Queues for new user. First, use Decision element to check if user has selected to clone public groups/queue via input Screen, If it is true, we will clone it.

All public groups and Queues that user is part of, can be queried from salesforce via standard object ‘GroupMember‘. To create new record of this object, we need to have value of fields GroupId & UserOrGroupId.

Now here in flow, using Get record, query GroupMember records where UserorGroupId equals id of existing user as shown below.

Get Record Element for getting GroupMember records for a user

Now, using these GroupMember records, we will create same GroupMember records for new user so that new user becomes part of same groups and queues as existing user. GroupId will be copied from existing user’s groupMember records and UserOrGroupId will be newly inserted user’s Id from Part 1.

Here we need 2 variables, First, a single record variable, ‘newGroupMemberRec’, this is temporary variable to be used to copy single record. Second, a collection variable, ‘collectionNewGroupMembers’ to store all copied groupMember records. both variables are of type GroupMember

Now, as shown below, using Loop element, go through each groupMember records, in For each, using assignment element, assign GroupID & new user Id to a new variable ‘newGroupMemberRec’ and then add this element to collection variable ‘collectionNewGroupMembers’. Finally, at the end of the loop we will have new user’s Group member Records in Collection.

Assignment Element for Group members

Now Insert this collection, so New user is now part of all the public groups and queues as same as existing user.

Part-3 :

How to Clone user via Screen Flow-3

This part is pretty similar to part-2, we will cover how to clone user’s Permission Set Assignment for new user.

All Permission Set License assignment of User, can be queried from salesforce via standard object ‘PermissionSetLicenseAssign‘. This PermissionSetLicenseAssign object has essential standard fields like PermissionSetLicenseId & AssigneeId to save its record.

Now, as similar in part-3, use get record element to get PermissionSetLicenseAssign (PSLA) records where AssigneeId is record id of existing user. then, create 2 variables one single variable and other collection.

After this, Loop through existing user’s all PSLA records, to create new PSLA record for new user, wherein PermissionSetLicenseId is copied from old record and AssigneeId is id of newly inserted user.

at end of the loop, Insert PSLA record collection in order to create New user’s Permission Set License.

Part-4 :

How to Clone user via Screen Flow-4

In this part, we will cover how to clone user’s Permission Sets & Groups for new user.

All Permission Sets & Groups that user is part of, can be queried from salesforce via standard object ‘PermissionSetAssignment‘. This PermissionSetAssignment object has essential standard fields like PermissionSetId & AssigneeId to save its record.

So as we did before, first use get record element to retrieve PermissionSetAssignment (PSA) records where AssigneeId is record id of existing user.

Now, let’s loop through this PSA records and save its PermissionSetId values into one separate collection. Using this collection of PermissionIds, we will query Permission Sets records with filter where IsOwnedByProfile = false as shown below

How to clone user via flow - get Permission Set Rec

Because salesforce automatically create one Permission Set record for profile assigned to User, which is unique and we don’t need it for cloning user.

Now loop over this Permission Set records and from its each record create new PSA records for new user as same as we did before.

Part-5 :

Hurray ! we are almost done, Now let’s make sure our flow can gracefully handle any unintentional error, So Let’s connect fault path for every create record elements and add Error Screen which display flow fault message.

How to clone user flow - add Fault Error Screen

In above screenshot, you might have noticed Roll Back Records element, This Roll Back records element make sure that in case of any faults for create record element during flow execution, all previously created record will be roll backed.

Part-6 :

Now, we need to create custom link button from User object. When you Click on this url button, it will launch Clone user flow in new tab.

How to clone flow button

Here, you can find above flow URL from Flow Detail page and userId flow variable seen above is the one we are using in flow which stores Id of user’s id.

Add this button on User page layout under Custom Links section.

See Clone User in Action

How to Deploy this Flow to your Sandbox

Click Here, to find a instruction to deploy Flow into your Sandbox.

Share this Now :

Related Posts:

  • Using Dynamic Highlight Panel Effectively - Salesforce Winter'25 SalesforceFox.com
    Using Dynamic Highlight Panel Effectively -…
  • User Access Policy in Salesforce : The Smartest way to Automate User Management Jobs
    User Access Policy in Salesforce : The Smartest way…
  • Display Apex-Defined Collection Data Directly into Screen Flow DataTable
    Display Apex-Defined Collection Data directly into…
  • Send Automatic Reminder Emails To Inactive Users
    Send Automatic Reminder Emails to Inactive Users in…
Automation, Flow, How To

Post navigation

Previous: Using Dynamic Highlight Panel Effectively – Salesforce Winter’25
Next: Tips to Improve Report Performance in Salesforce

6 thoughts on “How to Clone a User in Salesforce : Deploy screen flow solution to your sandbox with few clicks.”

  1. Sylna Gonzalo says:
    December 10, 2024 at 2:24 PM

    This is awesome for admin like me, Thank you for the nice explanation, I just deployed this flow through above package. it’s working like charm ! Another thing I love is that since this is unmanaged package, I can make changes on flow as per my needs.

    Reply
    1. Andrew says:
      June 12, 2025 at 10:19 PM

      Hey Sylna,

      Were you able to deploy it to Sandbox or straight to the Production? I am trying to deploy it to our sandbox for testing yet it is only giving me an option to deploy it to Production.

      Reply
  2. Andrew says:
    June 12, 2025 at 10:05 PM

    Hello!

    How can I deploy this to our sandbox? It is only giving me an option to deploy to a Production. I would like to test it out in our Sandbox before deploying it to the production.

    Reply
    1. Piyush Lakhani says:
      June 13, 2025 at 1:09 AM

      Hello Andrew !
      Thanks for checking out this solution.
      I understand your concern. this is happening due to managed package installation URL typically uses the login.salesforce.com domain for production.

      So on Login screen check URL if it starts with login.salesforce.com/…., You’ll need to change this to test.salesforce.com (or your sandbox’s specific login URL). Make sure to keep rest of the URL intact.

      Feel free to reach out if you still have any issue.

      Thanks & Best Regards
      Piyush Lakhani
      SalesforceFox.com

      Reply
  3. KJV says:
    May 15, 2026 at 8:36 PM

    Very nice! Do you have the flow definition on github?

    Reply
    1. Piyush Lakhani says:
      May 16, 2026 at 4:57 PM

      Hi,
      Yes, here is the link : https://github.com/phlakhani/Clone-User-via-Flow/tree/master/force-app/main/default/flows
      you can also find the same on post itself under section : How to Deploy this Flow to your Sandbox

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get Weekly Salesforce Quiz

Categories

  • Admin (8)
  • Apex (6)
  • Automation (7)
  • Best Practices (6)
  • Flow (5)
  • LWC (4)
  • Security (1)
  • SOQL (1)
  • Trigger (1)
  • Uncategorized (1)

Recent Posts

  • User Access Policy in Salesforce : The Smartest way to Automate User Management Jobs
  • Display Apex-Defined Collection Data directly into Screen Flow Data Table
  • How to Secure Your Salesforce Org: First Steps Against Cyber Attacks and Social Engineering
  • Make Salesforce Screen flows more Interactive with Toast Messages
  • How to Zip & Unzip files Natively in Salesforce: Use This Ready-to-Use ZIP Utility

Tags

Admin Apex Aura Component Automation Best Practices Development Email Alerts Flow Flow Approval Process How To Lightning Experience LWC Reports Scheduled Jobs Security SOQL Tips Trigger User Management

Archives

  • November 2025 (1)
  • October 2025 (1)
  • August 2025 (1)
  • July 2025 (1)
  • June 2025 (2)
  • May 2025 (1)
  • April 2025 (2)
  • March 2025 (2)
  • January 2025 (2)
  • December 2024 (1)
  • October 2024 (1)
  • September 2024 (1)
  • August 2024 (1)
  • June 2024 (1)
  • April 2024 (1)
  • March 2024 (1)
  • October 2023 (1)
  • Linkedin
  • Youtube
  • Privacy Policy
  • Terms of Use
  • Contact
Theme: BlockWP by Candid Themes.
© 2023-2026 | SalesforceFox.com