Super Clone Pro
Flow Setup

Super Clone Pro’s functionality can be run from a Flow. From the Flow Builder, create a new Apex Action. Search for “Bulk Clone with Super Clone Pro“. Enter required parameters for the configuration name and a list variable of record Ids that will be cloned. A user will need permission to run the ScpCloneActionBulk Apex class to execute the logic.

The other Clone action named “Clone with Super Clone Pro” (without “Bulk” in the name) was designed for Process Builder, and it may not run as efficiently for all use cases.

Basics

Create List Collection Variable

Create a collection variable that will hold a list of record IDs. The flow will pass this variable into the Super Clone Pro action.

Create Action

Create an action to add record Ids to the collection variable that was created above.

Create an action to run “Bulk Clone with Super Clone Pro”.

Return Variables

The action returns a list of the Apex-Defined data type called ScpRecordResult. This data type contains two attributes. The first is a list of new record Ids that were created during the cloning named newRecordIdList. The second is a list of a different Apex-Defined data type called ScpRecordPair in a list attribute named recordPairList.

The newRecordIdList provides list of new record Ids. The recordPairList contains the same new record Ids. However, they are grouped together with the ID of the record they were cloned from. This structure requires extra looping to process through the results.

Add variable to the action’s output

Process the results in a loop. Below is an example that would process the record pair. The inner loop wouldn’t be required if processing only required data from newRecordIdList.

The outer loop processes the cloneRecordResultList.

The inner loop processes the recordPairList. If using the clone multiplier, there would be multiple new record IDs for each original record, and this could require an additional loop depending on the use case.

Additional Parameters

Parameters used in the configuration as URL Parameters to set field values can be passed into the action. There is an Apex-Defined data type called ScpKeyValue that can mock up the functionality that typically runs using URL parameters on the clone page. Create a collection of the Key/Value variables, and then pass them into the action.

Define the variables for Key/Value pairs.

Define the variable for the parameter list.

Assign the values to the Key/Value pair.

Add it to the Key/Value pair parameter list.

Pass the parameter list to the clone action.