Custom Button - Clone User - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Tony KayyaliTony Kayyali 

Custom Button - Clone User

 Can someone assist me with code needed to crerate a custom button to clone users? I have seen them before and thought they were very helpful. 

 

Thanks in advance
 

Best Answer chosen by Moderator (salesforce.com) 
Rhonda RossRhonda Ross
Here's the code that I'm using.  I don't remember that that last part on the end is doing.

/{!User.Id}/e?clone=1&retURL=%2F{!User.Id}&isdtp=mn

All Answers

Rhonda RossRhonda Ross
Here's the code that I'm using.  I don't remember that that last part on the end is doing.

/{!User.Id}/e?clone=1&retURL=%2F{!User.Id}&isdtp=mn
This was selected as the best answer
Tony KayyaliTony Kayyali
Thank you very much for your help

play buildplay build
Hi is there any documentation that lists out the typical useful simple buttons added or simple apex triggers. I have found a nice doco on common/typical workflows and approvals but not one for buttons (e.g. clone user) or one for simple apex triggers. 

essentially stuff alot people would like in core,... but not quite in their yet....
Jason AtwoodJason Atwood
We just launched Clone This User http://www.clonethisuser.com a free AppExchange application that not only clones users but associated permission sets, etc. 
Monalisa HalderMonalisa Halder
Profile field is not editable and it is not selecting the value from the user where it is being cloned. Any help on this will be much appreciated.
User-added image
Lorenzo Alali ☁Lorenzo Alali ☁
Option A
Just add, in the URL, /e?clone=1 at the end of ID of the User record you want to clone, the same as you would do for any record of any object

Option B1 - Simple
Create a Custom Link for the User Object as follow (Rhonda's suggestion minus the two last parameters that we do not need)
/{!User.Id}/e?clone=1

Option B2 - Advanced
Option 1 + Erasing some of the fields we obviously do not want to copy
/{!User.Id}/e?clone=1&
name_firstName=""&
name_lastName=""&
Alias=""&
Email=""&
Username=""&
CommunityNickname=""&
EmployeeNumber=""&
FederationIdentifier=""&
000000000000000=""&
new_password=False

For the last two lines:
- 000000000000000: if you have custom fields you want to reset as part of the clone, use their ID, not their API name (go to a field and look at its URL)
- new_password: this untick the "generate password" checkbox → if you have an SSO in place, you probably don't want your users to log in via login.salesforce.com

Option C
AppExchange (see past comments)