Super Clone
Clone Page and Custom Button Settings

The Clone page will make a copy of the primary object and the selected related list records. Field values can be set, copied, or left empty for both primary object and related list objects. If required, the Clone page can be skipped by checking the “Skip Clone Confirmation Page” check box on the configuration, so the user will directed immediately to the new object’s page.

  • Multiple related lists can be presented on the same page.
  • Related records can be unselected/selected for cloning.
  • Press Clone to continue, and be directed to the page for the newly created primary object.
  • Press Cancel to return to the original record.

Custom Button Setup

Navigate to the primary object’s area for Buttons, Links, and Actions.

  • Create a new Custom Button for the object.
  • Enter a Label, Name, and Description.
  • Select Detail Page Button for the button to be available at the top of a page layout.
  • Select the behavior for the window after the button is pressed. Display in existing window with sidebar will result in an experience most users would expect.
  • Select URL for the Content Source.
  • Enter the path to the super clone page with URL parameters for the record id and a reference to the clone configuration name.

URL Example Explained

  • “/apex/dh_superclone__superclone” This is a reference to the Visualforce page. The namespace prefix is “dh_superclone”. It is separated from the page name, “superclone”, by two underscores.
  • “?” indicates the start of URL parameters
  • “rid={Opportunity.Id}” tells the clone page which record should be cloned. “rid” is a URL parameter, and “{Opportunity.Id}” is the parameters value that represents the record’s identifier. Change “Opportunity.Id” to reference the primary object that is being cloned.
  • “&” separates URL parameters
  • “cfg=MyConfig” is the parameter that references the name of the Super Clone configuration. Change “MyConfig” to the name your configuration.

Additional URL Parameters

saveURL2 – Use the url parameter ‘saveURL2’ to redirect the page after the clone operation.

  • The URL parameter ‘saveURL2’ takes a URL encoded string as the parameter’s value.
  • A constant of ‘[newid]’ is replaced with the new record’s Id in the ‘saveURL2’ parameter. This allows you to redirect to a new page passing the new record’s Id.

  • The custom button URL above will redirect you to the Opportunity tab after the clone completes successfully.

  • The custom button URL above will redirect you to the standard Opportunity edit page after the clone completes successfully.
  • This string ‘%5Bnewid%5D%2Fe%3FretURL%3D%2F%5Bnewid%5D’ is the URL encoded value for this ‘[newid]/e?retURL=/[newid]’, which is what shows in the location bar when editing a record.

retURL2 – Use the URL parameter ‘retURL2’ to redirect the page when the Cancel button is clicked.

  • The url parameter ‘retURL2’ takes a URL encoded string as the parameter’s value.

Primary Object Field Name – Set a field’s value on the primary object with a URL parameter that is named with the field’s API name.

  • In the configuration, the field action must be set to ‘Set Value’ for the field that will be assigned a value to using a URL parameter.
  • The configuration page will request Date and DateTime data types have a valid date when ‘Set Value’ is selected. Enter a date, and the URL parameter will override the value specified in the configuration.
  • Formula logic can be used in the custom button to manipulate text, calculate dates, or perform conditional logic. For example, date logic can be used to calculate new dates based on the existing record’s date values.
  • The following example will would assign the ParentId field value in the new cloned record. The result would be that the new account is a child of the original account.