How to Clone a Record with Flow in Salesforce

In Salesforce, cloning a record means creating a copy of the record. We can clone a record using a Clone button, but it does not clone the related fields in the record, i.e., the records that are not on the page layout.

In that situation, we can use the Salesforce flow in order to clone a Salesforce record.

In this Salesforce tutorial, we will learn how to clone a record with the flow in Salesforce. We create a screen flow and add that flow to the record page, and then we will clone a record with the help of that.

Using Flow to Clone a Record in Salesforce

In Salesforce, flows are used to automate the data process in the org. to streamline it efficiently. We can also use the flows to clone a record. We have a feature to clone records with the help of the Clone button, but it does not clone the related record of any record.

There is another standard button, Clone with Related, to clone the records with their related records but this feature is available for the Campaign and Opportunity objects only. When you need to clone the records of objects like Account, Contacts, and Cases, then you can use the Screen Flow to clone the records with their related records.

Create a Flow to clone records in Salesforce

To create a flow that will clone records, navigate to the Setup page of Salesforce and follow the below steps.

1. Navigate to the Flow setup. For that, go to the Quick Find box, search for Flows under Process Automation, and select it.

2. In the Flows setup window, click on the button New Flow.

3. Select the option Screen flow and click the Create button.

Create a Salesforce flow to Clone records

4. In the flow, click on the “+” icon and select the option Screen under the heading Add element.

5. Enter the Label of the Screen. For example, I have entered the label Create an Account Clone.

See also  How to Call a Flow From Button in Salesforce | How to Launch Flow From Button in Salesforce

6. After this, drag and drop the Display text to the screen region and add the label for that also; then, in the text area, enter the text that you want to display to the user when they create a clone.

In this example, I have entered a confirmation text in the display text section. At last, click on the Done button.

Create a Clone of Salesforce Record with Flow

7. Now, we will create a variable to get the recordid of the Account record. To create a variable, click on the Toggle button, then click on the New Resource button.

Use Screen flow to create a clone with related records in Salesforce

8. Enter the following details to create a new resource.

  • Select the Resource Type as a Variable.
  • Enter the API Name as recordid.
  • Select Data Type as Text.
  • Activate the checkbox Available for input and click on the Done button.
Clone a Salesforce record with Screen flow

9. Now, to get the record ID of the account record, go to the flow, click the “+” icon, and select the component Get Records.

How to clone a record in Salesforce using Flow

10. In the next window, enter the details to create the get record component.

  • Enter the Label and API Name for the get record component. For example, I have entered the label Get Account Record.
  • In this example, I’ll clone the Account record, so I have selected the Object as Account.
  • In the conditions, select the Field as Id, Operator as Equals, and Value as recordid, i.e., the variable we have created in the above steps to get the id of the current record.
How to Create a Record clone with Salesforce Flow

11. Now, we will create another screen to overwrite the Name of the Cloned account, so below the Get Account component, add a Screen element.

In the New Screen window, enter the label for the screen, then add a text component to the Screen region and name it as Account Name; this component will overwrite the name of the cloned record.

In the same way, you can add other components to write other fields in the cloned record.

See also  How to Create a Case Related to an Account using Flow in Salesforce

At last, click on Done.

Create a Clone of an Account record with Salesforce flow

12. Now, we will add a component that creates a Clone record. For that, click on the “+” icon below the second screen component and select the element Create Records.

Then, enter the name for the Label for this component and, after this, activate the radio button Use separate resources and lateral values.

After this, select the object Account.

Use Salesforce flow to clone an Account record

13. On the same page, we will set field values for the account or object that you have selected. In the Field section, select the object field, and in the Value section, select the value for that field.

There are two options to map the value: either the variable you have created or the Get Account element. Here, for the name field, select the Account name value from the screen component that we have created in the above steps.

If we select the name from the get element, then it will name the cloned account as the current account, and that will return an error.

The rest of the fields that you don’t want to over-write can be mapped with get account element values.

How to clone a record using flow in Salesforce

14. At last, click on the Save button, then enter the Label of the Screen flow and click Save.

Clone a Salesforce record with Flow

15. To check the errors and the working of the flow, click on the Debug button at the top of the screen.

How to Create a record Clone in Salesforce using a Flow

16. In the Record ID, enter the ID of the account from which you want to create a clone and then click the Run button.

The ID will be the 15-digit code that you will get from the URL of the account record.

Use Screen flow to clone a Salesforce account

17. We will see the first screen of the flow; here, click the Confirm/Next button.

Create a Clone with the related records in Salesforce

18. In the second window, we can see that the flow has fetched the details of the entered account. On the second screen, enter the name of the new cloned record and click Next.

Create a Clone of an Account record with related records in Salesforce

19. As we can see, the flow ran successfully, and in the Debug details on the right side, we can see that the clone record is created with the over written name.

See also  Auto-Deactivate Users with Schedule-Triggered Flow in Salesforce
Clone a Account record clone in Salesforce using flow

20. These changes will be reflected in the the records of the org. To check the created clone record, navigate to the Accounts tab. Here, we can see the cloned record.

Create Record clone with related records using flow in Salesforce

21. Now, click the Activate button to activate this screen flow.

Create a Flow to clone the records in Salesforce

After this, you need to add this screen flow on the Account record page. This flow can be added with the help of a lightning component or a button that will call this flow.

#link of the article – Create a flow from the button.

In this way, we can clone a record in Salesforce by following the above steps.


In Salesforce, flows are useful in creating the clone of the records when we need to create the clone with the related records. In this Salesforce tutorial, we have learned about the process of creating a flow to clone Account records. This same process can be followed to create clone records of other Salesforce.

Along with this, we also learned to debug the created flow. By now, you will be able to create the record clone flows in your org.

You may like to read: