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
Marcio Zima.ax1538Marcio Zima.ax1538 

Custom Clone Button

I'm trying to insert a custom clone button on a visualforce page. I found a code that seems what I need, but it's not working

 

<input value="Clone" class="btn" name="Test" 
                onclick="navigateToUrl('/apex/myEditPage?clone=1&id={!Object.id}&retURL=%2F{!Object.id}')" 
                title="Test" type="button" />

 

After the click, it catches values of the fields, but when I click on save, nothing happens It doesn't create a new id with the values of the original record.

 

Any suggestion?

Ashish_SFDCAshish_SFDC
Hi Marcio, 

Try this, 

<apex:commandButton value="Clone" action="{!URLFOR($Action.ObjectName.Clone,<ObectName>.id)}"/>

https://help.salesforce.com/apex/HTViewSolution?urlname=Visual-Force-Cloning-1327109086289&language=en_US

Regards,
Ashish