How To: Filter Records in Related Lists With Super Clone Pro
December 16, 2017
How To: Clone a record and delete the original record in Salesforce
April 25, 2018

How To: Clone a Hierarchy of Records Asynchronously with Super Clone Pro

Cloning large and complex hierarchies of records can run into platform limits. Salesforce’s governor limits for CPU time limit, heap size, and view state can prevent successfully cloning a hierarchy. Factors that impact this include a large numbers of records, lots of data in the records, or a significant amount of custom Apex/Workflow/Formula logic. One solution is to run the Super Clone Pro process asynchronously. This provides higher limits to process the cloning logic successfully.

Submitting the cloning logic asynchronously requires additional custom coding. There is no warranty on the code below because each Salesforce environment and object being cloned is different, but this will hopefully provide a starting point that will help with your cloning.

  • This example uses custom objects called Solution and Solution Items. A custom Visualforce page will prompt the user for a new name, start date, and end date. This information will be passed to a queueable Apex job that runs the Super Clone Pro api.

  • The Visualforce page uses an actionpoller to check the job status. The Status will updates on the page job is processing and complete.

  • After completion, the records have been inserted, and will be available for the user to navigate to.

 

Super Clone Pro Configuration: solutionClone
* Notice the field actions set to “Set by URL Paramter”. The text in the Value column corresponds to the keys of the parameter map that is passed into the Super Clone Pro API. The API will apply the values from the parameter map to the fields in the Solution object.

Apex Class Queueable Job: SolutionCloneQueueable

Apex Visualforce Controller: SolutionCloneController

Visualforce Page: SolutionClone

Custom Button on Solution page layout

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.