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
developerTeamdeveloperTeam 

Custom Clone Button to Update Name Field

Hi,

 

I Need a Custom Clone Button which when clicked Should have Same functinality of Standard Clone Button, but only Name Should be Updated. Such as for Example

 

I have CustomObject__c with fileds like ID,Name,Custom_BatchNo__c, Custom_Type__c..... etc

As on Detail page of a CustomObject__c record which has Clone Button which when clicked gets all the Fields names pre populated with Same Name's of the earlier Record.........

Now,

Here I need the Name feild to be changed as  Name: Clone of Record

 

How to Achieve this Scenario.... am trying with Custom Button with Javascript.

-Thank you

 

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

Create custom detail page url button.

and give standard clon url with name field value.

 

See below example for clone campaign record.

 

URL in button: /{!Campaign.Id}/e?clone=1&retURL=%2F{!Campaign.Id}&cpn1=Clone of Record-{!Campaign.Name}

 

 

where cpn1 if name control id which is taken from clone standard page using firebug.

All Answers

Dhaval PanchalDhaval Panchal

Create custom detail page url button.

and give standard clon url with name field value.

 

See below example for clone campaign record.

 

URL in button: /{!Campaign.Id}/e?clone=1&retURL=%2F{!Campaign.Id}&cpn1=Clone of Record-{!Campaign.Name}

 

 

where cpn1 if name control id which is taken from clone standard page using firebug.

This was selected as the best answer
developerTeamdeveloperTeam
Hi Dhaval,
The Code didn't work .... its showing the same as Clone .... The name field is not being showed cause I just replaced with Campaign with my CustomObject__c and What is cpn1 I didn't changed it in my Object the Through Fire Bug I found the name of Clone Button is Clone ... itself.... then Whats the way to Change the Name Field?
Dhaval PanchalDhaval Panchal
cpn1 is the control name which is in standard new page. Load standard clone page and start fire but. and take name of that control (in which name is displayed) and use that id in url.