Hey folks!

The post will help you create a custom clone button on the object view page in salesforce.
Recently i had a requirement for creating a clone button on a custom object. After a day long grilling the internet and many salesforce forums it was concluded that without a visualforce or lightning component we cannot have the clone feature on the list view page in salesforce. You will first try to update your search layout settings in your object but the standard clone button is not available there to be added on the page. I also tried creating a screen flow which will take the current record id and then clone create a duplicate record but the issue was once again that i was unable to get the flow action button on the list view page as only the non flow quick actions were available in the object search settings which can be selected for addition on list view page.

After trying many options i thought of an ugly workaround for this. Follow below steps to create a custom clone button on the object view page in salesforce.

Create an Update record Action

Well, first you need to create a hidden checkbox field for the object with default value unchecked. Lets name the field as Clone? (Adding the ? to distinguish clone button with the checkbox field)

Go to the object and create a quick action button by the name of Clone and select the type – Update record. In the pre-defined value set the value of the field Clone? to True. So the idea is that whenever a user clicks the action button this checkbox value is set to true.

clone button salesforce list view

Create a Process Builder

Create a process builder on the said object.
Add criteria –
Clone? = True

Action 1:
Create new record of the same object. Add all the fields which you want to clone and using the Field Reference operator type set the new field values from the old record from which we are cloning.

Action 2:
Within the same Immediate actions add another action which will set to false the Clone? field from the previous record which we are cloning. This is done so that if the user tries to clone from the same record we need to make sure that the checkbox is set to unchecked otherwise our process which creates a new record will not fire.

Once the process builder is created save it and activate.

Add Clone action button on List View Page

Go to object manager -> Search layout for Salesforce Classic -> List View
Add the custom clone button to the Selected quick Actions and save.

Time to test.

Go to the lsit view page and select any record by clicking the tick box and click the clone button on the list view page.


Malcolm · 22/07/2020 at 3:02 pm

Thanks Yashad, this is great! The only challenge is that any changes made in the popup dialog, are applied to both the clone and the original object. Any ideas on how to fix this, so that the original remains unchanged, and the changes are applied to the clone?

    yashadtayal · 22/07/2020 at 3:08 pm

    Use the process builder to reverse set your value to the previous value of the field for your original record. You can set this in the same process. In the post check the action 2 where we set the value back to the previous one.

Leave a Reply

Your email address will not be published.