function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael MMichael M 

URL hack that exactly copies functionality of "clone"

Hello, I need to create a custom button that serves the EXACT functionality of the standard clone button (long story why...). What is the easiest way to do this? Is there a simple url hack?
Best Answer chosen by Michael M
VinayVinay (Salesforce Developers) 
Hi Michael,

Try below snippet.
/{!Account.Id}/e?clone=1

References:
https://help.salesforce.com/articleView?id=000316430&type=1&mode=1
https://salesforce.stackexchange.com/questions/318462/lightning-url-hack-from-custom-button

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Michael,

Try below snippet.
/{!Account.Id}/e?clone=1

References:
https://help.salesforce.com/articleView?id=000316430&type=1&mode=1
https://salesforce.stackexchange.com/questions/318462/lightning-url-hack-from-custom-button

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
This was selected as the best answer
Michael MMichael M
Hi Vinay, Thank you- that works, but with one exception, as follows. The standard clone button has functionality where if you clone a converted Lead, and click clone, it will create a brand new Lead (it will use the page layout for new Lead, instead of page layout for converted Lead), and copy over all the fields. With this custom button with above formula, when i place this button on the converted page layout, then try to clone it, it clones it as converted-record-type. Does that make sense? Is there a way to mimic the standard clone button's functionality in the sense that even on the converted-lead record types, it clones it INTO a NEW lead record type?
VinayVinay (Salesforce Developers) 
You might need to append appropriate record type id in clone button functionality.  Eg. For button A on layout-1 you might need to refer record type id and button A(with different api name) you need to use on layout-2.

Thanks,
Michael MMichael M
Hi Vinay, what would that code look like? If you don't mind. 
VinayVinay (Salesforce Developers) 
Something like below and it worked for me on Account.
/lightning/o/Account/new?defaultFieldValues=
    Name={!URLENCODE(Account.Name)},
    OwnerId={!Account.OwnerId},
    AccountNumber={!Account.AccountNumber},
    CustomCheckbox__c={!IF(Account.SomeCheckbox__c, true, false)}

Thanks,
Michael MMichael M
So with this approach, i will need to enter each field separately? 
VinayVinay (Salesforce Developers) 
Yes and also record type if you have any.