Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create a Child Flow to Clone a Record

          Create a Child Flow to Clone a Record

          Create a flow to clone a record with all field values stored in a record variable. This flow is called by a parent flow using a Subflow element. This flow returns the cloned record to the parent flow.

          Required Editions

          View supported editions.
          User Permissions Needed
          To open, edit, create, activate or deactivate a flow using all flow types, elements, and features available in Flow Builder, including Einstein and Agentforce for Flow: Manage Flow
          Note
          Note When you select the Automatically store all fields option in a Get Records element, the flow determines what fields you reference within that flow, and stores values only for the referenced fields. Therefore, if you use a Create Records element within the parent flow to clone the record, only the field values referenced within the flow are copied to the new record. When you use a child flow to clone the record, flow copies all fields that the running user has edit access to.

          Before you begin, review Read-Only Field Restrictions for Flow Record Processing

          1. Open the Flows list view.
            • From Setup, in the Quick Find box, enter Flows, and then select Flows.
            • From the Automation app, select the Flows tab.
            • From the Flows tab in any Lightning app, click the actions menu and select Open Flow.
          2. Create an autolaunched flow.
            • From Setup, click New Flow, select Autolaunched Automations, and then select Autolaunched Flow (No Trigger)..
            • From the Automation app, click New, selectAutolaunched Automations, and then select Autolaunched Flow (No Trigger).
          3. Add an input variable to store the record variable containing the original record.
            1. To open the Toolbox, click Toolbox icon.
            2. Click New Resource, and then select Variable.
            3. Enter an API name and description.
            4. For Data Type, select Record.
            5. For Object, select the object of the record to clone.
            6. for Availability Outside the Flow, select Available for input.
            For example, to clone a case record, add a caseToClone record variable.
            Field Value
            API Name caseToClone
            Description Stores a case record that contains the field values of the original case record, and is passed into the flow.
            Data Type Record
            Object Case
            Availability Outside the Flow Available for input
          4. Add a record variable to store the new record values.
            1. Click New Resource, and then select Variable.
            2. Enter an API name and description.
            3. For Data Type, select Record.
            4. For Object, select the object of the record to clone.
            5. For Availability Outside the Flow, select Available for output.
            For example, create a variable to store a new case record and return it to the parent flow by adding a newCase record variable that available as output from the flow.
            Field Value
            API Name newCase
            Description Stores the field values of the original case record and is available as output from the flow.
            Data Type Record
            Object Case
            Availability Outside the Flow Available for output
          5. Add an Assignment element to clear the value of the record’s ID.
            1. Click Add element plus icon, and select Assignment.
            2. Enter a label, API name, and description for the element.
            3. For Variable, select the record variable that holds the new record.
            4. For Operator, select Equals.
            5. For Value, select the record variable that holds the record to clone.
            6. Click Add Assignment.
            7. For Variable, select the primary ID field of record variable that holds the new record.
            8. For Operator, select Equals.
            9. For Value, select Blank Value (Empty String).
            For example, to set the value of the new record variable to the record passed into the flow and to set its case ID to an empty string, add an Assignment element.
            Field Value
            Label Set newCase Values
            API Name SetNewCaseValues
            Description Sets the newCase record variable to caseToClone, and then sets newCase’s case ID to an empty string.
            Variable newCase > Entire Resource
            Operator Equals
            Value caseToClone > Entire Resource
            Variable newCase > Case ID
            Operator Equals
            Value Blank Value (Empty String)
          6. Add a Create Records element.
            1. Click Add element plus icon, and select Create Records.
            2. Enter a label, API name, and description for the element.
            3. For Object, select the object of the record to create.
            4. For How Many Records to Create, select One.
            5. For Record, select the record variable created in step 4.
            For example, add a Create Records element and configure it to create a record using the field values stored inthe newCase record variable.
            Field Value
            Label Clone Record
            API Name CloneRecord
            Description Creates a copy of the record in newCase, and stores the result in the newCase record variable.
            How to set record field values From a Record Variable
            How Many Records to Create One
            Record newCase
            The Case ID field of newCase now contains the new record’s case ID.
          7. Save the flow.
            For example, click Save and then use these values to save the flow.
            Field Value
            Flow Label Clone Record with All Fields
            API Name Clone_Record_with_All_Fields
            Description Creates a copy of the record passed into the flow, with all fields.
            The sample autolaunched flow that clones a record with all fields from the original record. The sample flow contains an Assignment element and a Create Records element.

            Click Save.

          8. Activate the flow.

          This child flow is now ready to be called by the parent flow using a Subflow element.

           
          Loading
          Salesforce Help | Article