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.
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 :

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).

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 :

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.

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.

Now Insert this collection, so New user is now part of all the public groups and queues as same as existing user.
Part-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 :

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

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.

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.

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.





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.
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.
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.
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
Very nice! Do you have the flow definition on github?
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