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
benwrigleybenwrigley 

How to replicate 'Clone' button and put user in edit mode

Hi All,

I want to replicate the Clone button as much as possible but with a few changes and I'm not sure how salesforce have done it.

When you click clone now you are taken to a copy of the object in edit mode. Has the copy actually been created at that point and we are just editing or are we just in a 'new' object window?

Also some of the Opportunity custom fields I have made read-only for certain users but I've noticed that clicking clone will still populate those fields in the new object. When I tried to replicate that behaviour I am told that I don't have permission to edit those fields. How does the default Clone button get around that issue?

TIA

Ben
OneNewbieOneNewbie
To replicate the clone functionality simply create the scontrol and replace the window with https://na1.salesforce.com/'ID'/e?retURL=%2'ID'&clone=1 where ID is the id you want to clone. The copy is not save until you actually click on the Save button.

Hope this helps.
benwrigleybenwrigley
Thanks for that, but I think I probably explained myself badly.

I want to acheive exactly what the clone button does now, however, I want to be able to choose which fields get populated in the copy. To do this I need to copy the clone functionality which I am not sure how to do.

Any ideas?
OneNewbieOneNewbie
If you use Firefox you can find out the parameters for the forms. Then you can add them to the URL such as https://na1.salesforce.com/'ID'/e?retURL=%2'ID'&clone=1&con5=myownfield&con6=anotherfield.
 
The result will be fields pre-populated. Hope this helps.
 
 
Amber NeillAmber Neill

I know this thread is old, so forgive me.  I'd like more information on passing parameters.  Can you be more specific on what is "con5" and "con6"?  Is that a reserved phrase of some sort?

Thanks for your patience!
Amber

Amber NeillAmber Neill

Ok, I figured out the cas5 & cas6 (http://salesforce.phollaio.com/tag/structure/) but now I need to know how to specify the record type.

BTW, I'm thinking that clone isn't really what I want to do.

Thanks in advance for any help or advice!
Amber

JTSFDCJTSFDC
simply add &RecordType=insert record type id here