Super Clone Pro
Configuration Settings

The Super Clone Pro configuration controls the cloning and copying behavior. A reference to the configuration name is used for the clone and copy pages, in Process Builder, and from an APEX trigger. Both clone and copy functionality can share a single configuration. However, the copy functionality uses it a little different than the cloning. For example, the clone page uses all settings seen on the configuration. The copy page ignores the edit check boxes on the primary object because this page is intended only to copy the child relationships on one record to another existing record.

New Configurations

To setup a new configuration, select the Super Clone Pro app to see the Super Clone Pro Configuration tab. This tab shows a list of configurations and the New button.

Press the New button to create a new clone configuration. Enter a name for the configuration. Select an object. This is the main object that will be cloned for this configuration. Leave the action set as Clone. Press Create to continue.

Configuration Settings

The top of the configuration page contains the configuration name, primary object, page behavior settings, and a list of related objects that can be selected for cloning.

  • Configuration Name is the text used to indicate which configuration to process with in the custom button, Process Builder interface, or Apex API.
  • After Clone Display select what is displayed after the Clone action is performed. The ‘saveURL’ and ‘saveURL2’ URL parameters used in a Custom Button will override this selection.
    • Record List – Display a list of names and links to the cloned record.
    • First Record – Redirect to the new cloned record. The first cloned record will display when using the feature to clone multiple times.
    • Original Record – Redirect back to the source record that was cloned.
    • Object Page – Redirect to the default object page that shows recently viewed records and list views.
    • Super Clone Pro Edit Page – Redirect to Super Clone Pro’s Edit page after the clone page processing has completed. This is often useful when using the clone multiplier feature. It allows you to see and edit all cloned hierarchies on one page.
      • Use the “cfgedit” URL parameter to specify a different configuration for the edit page than was used for the clone page. This can be useful when you want to show a different set of fields when editing the hierarchy than was shown when cloning.  The URL parameter would look similar to this, “&cfgedit=myeditconfig”.
  • Description is a field to store helpful information on when or how the configuration is used.
  • Show Detailed Error Message will display the Apex exception message for errors during the insert or update of records. This can be helpful when troubleshooting why an insert or update failed, but it is not necessary to check for typical use.
  • Skip Clone Configuration Page will cause the clone process to bypass the Clone Confirmation page except when a problem is encountered during cloning. This setting is only used by the clone page.
  • Allow Cloning Multiple Times will display an input on the Clone Confirmation page that asks the user to enter the number of times a record should be cloned. Use caution when entering large numbers as a multiplier on the Clone Confirmation page because this may result in errors if governor limits are exceeded.

Relationship Hierarchy

The Relationship Tree section of the page allows you to add, remove, and change the display order of the child relationships.

  • Click the “Clone” button in the Relationship Tree to add child relationships.
  • Click the red “X” button to remove the relationship.
  • Click the up or down arrow to adjust the order in which the relationships display on both the configuration and clone confirmation pages.

After clicking the “Clone” button on a relationship, a window will appear that will allow you to select which child relationships to clone. Check the checkbox next to the relationship name to add a child relationship to the configuration.

The new relationship will appear in the relationship tree, and a section for the field configurations will appear at the bottom of the page in the Field Value Configuration section.

  • Click the relationship name to expand or collapse an individual section of field configurations.
  • Click “Collapse All” to hide all field configurations.
  • Click “Expand All” to show all field configurations.

Relationship Settings

The Field Value Configuration section contains a list of fields for the primary object and each selected child relationship. These configurations determine what a field’s value will be set to, how the field will appear on the page, and actions that will occur for the child relationships .

Settings at the top of each section control how the records are displayed on the confirmation page.

  • The Clone/Reparent picklist on the relationship title bar controls if new records are inserted from a cloned record or existing records are updated to relate to a different parent. The ‘Reparent’ option will only display if the relationship field can be updated and if the field relationship allows reparenting in the case with Master-Detail relationships.
  • Display Setting controls how the records are displayed on the confirmation page for each relationship.
    • Detail View – Display all records for the relationship. The number of records queried per relationship will be limited 1000. This is because Visufalforce pages limit collections displayed on a page to 1000 items.
    • Summary View – Display a count of records for the relationship. This is not applicable to the primary object. A record limit is not put on the relationship query when Summary View is selected.
    • Hidden – Hide records for the relationship. A record limit is not put on the relationship query when Hidden is selected.
  • Hide Record Selection Checkbox controls if a checkbox is displayed on the confirmation page that will allow the user to uncheck records they do not wish to clone. This is not applicable to the primary object.

Filter By allows the records from the relationship to be filtered by a Checkbox or Checkbox Formula field. When Filter By field is specified, records where the filter checkbox is equal to true will be available for cloning and copying. Records where the filter checkbox is equal to false will be excluded. Using a checkbox formula field lets you leverage the power of Salesforce’s formula engine, so you can include things like references to related objects, conditional logic, date calculations, etc.  Find additional information about filtering with URL parameters here.

  • None – The none option indicates no filter field has been selected, and the all available records will be available.

Sort By contains a list of fields that can be used to sort the child relationship.

  • Default – If the first field set to display is sortable, the records will be displayed in ascending order by its value.
  • None – The records will not be retrieved in any specific order. This will typically be the order the records were created in, but it is not guaranteed.
  • Other Field Names – The records will sort in ascending order by the selected field.

Field Value Settings

Each field has its own configuration. The options vary depending on the fields type and properties.

  • Field Label is the label that will display on the confirmation page.
  • API Name is the underlying identifier of the field on the object.
  • Data Type describes what kind of information the field stores.
  • Action is the action that will occur during cloning and copying processes. More detail is provided below.
  • Value is used by some Actions to indicate more detail about how to process the field.
  • Show checkbox allows the field to be displayed on the confirmation page. The checkbox in the column header will check or uncheck all active checkboxes in the section below it.
  • Editable checkbox allows the field to be changed on the confirmation page. The checkbox in the column header will check or uncheck all active checkboxes in the section below it.
  • Required checkbox makes the field required on the confirmation page. The checkbox in the column header will check or uncheck all active checkboxes in the section below it.
  • Display Order is the sequence which the fields will display on the confirmation page.
  • –renumber– link will change the Display Order values to multiples of 5.

The Action column drop-down list contains a few different actions depending on the field, field type, and permissions.

  • — Clone — will copy the source record’s field value.
  • Leave Empty will null out the value, so the new record’s field will be left empty.
  • Exclude from Query is an option for Name fields. This prevents the field from being included in the queried object records. Selecting Exclude from Query is required when cloning Person Accounts.
  • Set Value will allow field values to be specified. Reference fields will show a lookup to select a record.
  • Set to Default will use value defined in the field definition’s default to set the value in the cloned record.
  • Set by URL Parameter will set the field value to a value found in the confirmation page’s URL.
    • Enter text into the Value column that will be used as a URL parameter name. For example: myparam.  Then when configuring the custom button, you can specify “&myparam=theValue”.
  • Reference Clone / Clear is used on reference fields. If the record referenced in the reference field was cloned in the record hierarchy, the value will be updated to reference the new cloned record. Otherwise, the value will be removed from the lookup field. This is useful for parent records that reference a specific child record in the relationship tree and child records that have lookups to the parent record.
  • Reference Clone / Keep is used on reference fields. If the record referenced in the reference field was cloned in the record hierarchy, the value will be updated to reference the new cloned record. Otherwise, the field value will retain the cloned value. This is useful for parent records that reference a specific child record in the relationship tree and child records that have lookups to the parent record.
  • Clone with Prefix will add a text before the cloned value. This is only for fields with a String data type.
  • Clone with Suffix will add a text after the cloned value. This is only for fields with a String data type.
  • Current User is an option for Owner ID fields, and it will set the record owner to the user who is performing the clone operation.
  • Current Date is an option for Date fields, and it will set the field value to the current date.
  • Current Date/Time is an option for Date Time fields, and it will set the field value to the current date and time.
  • +/- Days from Current is an option for Date and Date Time fields, and it will set the field value to the current date or data time plus the specified number of days.
  • +/- Days from Record is an option for Date and Date Time fields, and it will set the field value to the record’s date or data time plus the specified number of days.
  • Display Only is displayed for formula and non-createable fields.
  • Relationship Field is displayed for the field that references the parent object in the relationship.
  • Action Formula List allows for more advanced date logic and setting a field in the cloned record to that of a different field on the original record. More detail can be found below.

Action Formula List Options

Action Formula List is a comma separated list of actions to be performed on a field. The current list of actions include the following.

  • FIELD( ) – within the parenthesis, specify the API field name of another field on the object being cloned.
  • RELATIONSHIPID( ) – assigns the record Id of the new parent record on a clone operation or the record designated as being copied to on a copy operation.
    • On a copy operation, this action allows child records to be copied from one object type to the same or different object type.
    • On a copy operation, use one of three options within the parenthesis to control the value of the original relationship field.
      • toid – assigns the the Id of the record designated as being copied to.
      • fromid – assigns the Id of the record designated as being copied from.
      • clear – clears the relationship field value. This will throw an error if the field is required, as with Master-Detail relationships.
    • On a clone operation, the Id of the cloned parent will always be assigned to the relationship field, so no value is needed within the parenthesis.
      • The parenthesis “()” are still required for the setting with a clone operation.
    • Fields that use “relationshipid()” will not show a value on the confirmation pages because the field values are assigned just prior to inserting the child records.
    • No other keywords can be included when using the “relationshipid()” action.
  • ADD( ) – valid for numeric field types. Adds the specified value to the field.
  • SUB( ) – valid for numeric field types. Subtracts the specified value from the field.
  • MUL( ) – valid for numeric field types. Multiplies the specified value to the field.
  • DIV( ) – valid for numeric field types. Divides the field value by the specified value.
  • CUR – valid for date and datetime field types. Set the field to the current date or date time.
  • LDM – valid for date and datetime field types. Set the field to the last day of the month for the date value being processed.
  • y( ) – valid for date and datetime field types. Set the year, add years, or subtract years.
  • m( ) – valid for date and datetime field types. Set the month, add months, or subtract months.
  • d( ) – valid for date and datetime field types. Set the day, add days, or subtract days.
  • hr( ) – valid for datetime field types. Set the hour, add hours, or subtract hours.
  • mn( ) – valid for datetime field types. Set the minute, add minutes, or subtract minutes.
  • s( ) – valid for datetime field types. Set the second, add minutes, or subtract minutes.
  • pre( ) – valid for text field types. Prefixes a specified value on the field.
  • suf( ) – valid for text field types. Suffixes a specified value on the field.
  • >> – Actions following this symbol will be performed after the save button is pressed. This is often useful when using the clone multiplier feature because it will allow each of the cloned hierarchies to have fields with different values using the !index and !mult action formula list keywords.
  • !index – the clone hierarchy index. When using the clone multiplier feature, this keyword represents the sequence number of the cloned hierarchy.
  • !mult – the total number of cloned hierarchies requested. When using the clone multiplier feature, this is the number that is entered into the clone multiplier field.

Examples using the Action Formula list.

  • Copy a custom Item object from an Opportunity to a Quote using the RELATIONSHIPID() keyword.
    • The custom Item object would need to have relationships to both the Opportunity and Quote.
    • The configuration would be created on the Opportunity.
    • The formula action “RELATIONSHIPID(CLEAR)” would be used on the lookup reference field to the Quote.
    • The copy page would be loaded with an “rid” URL parameter of the Quote record Id, and a “fromid” URL parameter of the Opportunity record Id.
    • To keep keep the reference to the Opportunity in the relationship field, the keyword “RELATIONSHIPID(fromid)” could be used.
    • The automatic copy of custom items could also be run from Process Builder on the creation of a Quote.
  • If a date was null
    • y(+1) – the field value would still be null because arithmetic on a null value will result in an error.
    • CUR,y(+1) – the field value will first be set the the current date. Then a year will be added to the current date.
    • FIELD(MyOtherDateField__c),m(-1),LDM – the field will be set to the value of the other date field. Then one month will be subtracted, and finally the value will be set to the last day of the previous month.
  • If a date was 10/2/2016
    • y(2018),d(1) – the current field value will be used as the starting point, and the year will be set as 2018. Then the day is set to 1. The value of the field in the new record would be 10/1/2018.
    • y(+1),m(-1),LDM – the current field value will be used as the starting point, and one year will be added. Then one month subtracted, and the last day of the 9th month will be set. The value of the field in the new record would be 9/30/2017.
  • If you want to retain a reference to the original record id
    • FIELD(Id) – the field would contain the value of the original record’s Id.
  • If you want a field to contain the value of a different field after cloning. For example, if you have a renewal rate on a current opportunity. Formula fields can be created and used in the Action Formula list to incorporate more complex logic.
    • FIELD(Proposed_Renewal_Rate__c) – the field would contain the value that was in the Proposed_Renewal_Rate__c field.
  • If you want to use a field to set another fields value using the action formula list.
    • mul(field(myfield__c)) – this will multiply the value of the field by the value in ‘myfield__c’.
    • suf(field(myfield__c)) – this will suffix the value of the field with the value in ‘myfield__c’.
    • m(+field(myfield__c)) – this will add a number of months to the field. The field would need to be a date or datetime and ‘myfield__c’ would need to be numeric in this scenario.
    • the “field( )” action formula keyword can be used in combination with most of the other actions.
  • If you want a sequential indicator of the cloned hierarchy when using the clone multiplier feature. You can assign values text fields like the name with sequences like  “My Opportunity – 1 of 6″, My Opportunity – 2 of 6”, etc.
    • >>,suf( – ),suf(!index),suf( of ),suf(!mult) – this suffixes the current value with a dash, inserts a sequence number, inserts a constant of ‘of’, and inserts the total number of clones requested.
  • If you want each cloned hierarchy to have a date that is incremented by 1 month, and each hierarchy’s date is set to last day of that respective month.
    • >>,m(-1),m(+!index),ldm – this takes the value in the field and subtracts one month to set a base. Then the “m(+!index)” will add back that number of months for each sequence. Finally, the date will be set to the last day in the respective month.
  • If you want to divide a number by the total number of clones. This can take a number entered into a field, and have it divided evenly among all of the requested cloned hierarchies.
    • >>,div(!mult)

Be sure to Save after creating or updating a configuration. The next step in the process is to create a custom button.