It all started with a Twitter post…. Melissa Hill Dees asked on Twitter whether she can clone records declaratively based on certain conditions on Salesforce . The original Twitter post is here:
I gladly accepted the challenge and created an example on a Salesforce Developer instance.
Here we go:
We have a custom object for Projects, which has a lookup relationship to both the Account and the Contact. There are a many custom fields on the Project object, and they can be seen here:
Here is an example record:
The idea is that whenever a project is created or updated with a due date in 2020 and a budget of $1 million and above, we will clone this project record, update the due date by adding 90 days to it, and assign 1 to the Tier field. We will also check a checkbox called Clone so that our clone process will stop cloning records by checking this field. In other words clones will not be cloned further. Please note that I also modified the Name and the Description of the Clone Project by appending one or two words at the end.
Here are our process builder screenshots:
Our process is checking the conditions described above and passing the Records ID for the matching original Project record to a Flow. Here are our Autolaunched Flow screenshots:
To test the functionality, I will go over to the list view and update the budget of the existing record to $1 million. A clone record will be immediately created as follows:
If you have any questions please comment below.