custom clone button in salesforce

Salesforce provides Clone functionality for some standard objects(Standard Clone button),
However some standard objects do not have this button. For this purpose of cloning we will need to create custom button that will perform the functionality of cloning.

This cloning functionality can be achieved by writing a javascript for this custom button.

As an example lets create a custom button "Clone" on account that will clone the record.

Simply override your custom button "Clone" with the following java script and you will have your custom Clone button that functions exactly like standard clone button

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
window.parent.location.href="/{!Account.Id}/e?&clone=1&retURL=/{!Account.Id}";

retUrl specifies the location where you want to be on press of back button.

4 comments:

  1. Nice article Yoganand.

    If the needs are complex, please find this new app on AppExchange, iClone.

    You can clone any Salesforce record with any related list, plus do field over-rides, sorting, etc in just few clicks.

    URL: https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B39tWEAR

    ReplyDelete
  2. Here is another useful approach for cloning Parent and child related: http://christopheralunlewis.blogspot.com/2012/04/clone-plus-clone-salesforce-objects.html

    ReplyDelete
    Replies
    1. Hi Could you please forward code to my gmail id please.this is my mail id:akhishy@gmail.com

      Delete
  3. can we use this to oush a value into the related list object?

    ReplyDelete