Automatically Create a Record from a Flow

Automatically Create a Record from a Flow

Last Updated on April 16, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

How do you automatically create a record using Salesforce Flow?


After reading this blog, you’ll be able to: 

  • Understand the basic components of Salesforce Flow
  • Learn how to auto-create a record using Salesforce Flow

Business Use case

Corey Eridon is working as a System Administrator at Gurukul on Cloud (GoC). He received a requirement to build a flow that would automatically create a child case whenever a new case is created with the Case Reason – Breakdown.

Automation Champion Approach (I-do):

To automatically create a child case, Corey will use Salesforce Flow. 

Before we dive into the solution to help Corey, though, we need to first understand what Salesforce Flow is and its components. 

With Salesforce Flow, you can create simple and advanced automation  — all with the ease of point-and-click. Unlike workflow rules and Process Builder, Salesforce Flow allows for much more functionality, including but not limited to:  

  • Creating Screen flows and Autolaunched flows
  • Looping through records
  • Pausing flows
  • And much more

There are five basic flow types that should be considered before getting started on building a solution, which you can read more about here.

Flow Type Description
Screen Flow Guides users through a business process that’s launched from Lightning pages, Experience Cloud sites, quick actions, and more.
Scheduled-Triggered Flows Launches at a specified time and frequency for each record in a batch. This autolaunched flow runs in the background.
Autolaunched Flow (No Trigger) Launches when invoked by Apex, processes, REST API, and more. This autolaunched flow runs in the background.
Record-Triggered Flow Launches when a record is created, updated or deleted. This autolaunched flow runs in the background.
Platform Event-Triggered Flow Launches when a platform event message is received. This autolaunched flow runs in the background.

There are also a few Flow Elements that will need to be considered when designing your solution, which you can read more about here.  

To better understand Gurukul on Cloud (GoC)’s requirements, let’s break down the use case by the Salesforce Flow component. This will help us conceptualize the process by defining each action first. 

Component Process
Record-Triggered Flow When a new Case is created, the flow should trigger
Define Decision Conditions Cases with a field value of Case Reason = Breakdown will enter the flow
Create Records Element Create a child Case

Before diving further, let me also show you a diagram of the Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let’s begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Corey’s business requirement using After-Save Record-Triggered Flow. We must:

  1. Define Flow properties for record-triggered flow
  2. Add a decision element to check if the case reason is a breakdown 
  3. Add a create records element to create a child case

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
    1. Object: Case
    2. Trigger the Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done.

Step 2: Using Decision Element to Check if the Case reason is Breakdown

Now we will use the Decision element to check if the case reason is breakdown. 

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.Reason}
      2. Operator: Equals
      3. Value: Breakdown
  5. When to Execute Outcome: Only if the record that triggered the flow to run is updated to meet the condition requirements
  6. Click Done.

Step 3: Add Action – Create a Record

The next step is to create a child case, for this, we will use the Create Records element.

  1. On Flow Designer, below the Breakdown node, click on the +icon and select the Create Records element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Input the following information:
    1. Enter Label the API Name will auto-populate.
    2. How Many Records to Create: One
    3. How to Set the Record Fields: Use separate resources, and literal values
    4. Object: Case
    5. Set Field Values for the Case
    6. Row 1:
      1. Field: Status
      2. Value: New
    7. Click Add Field
    8. Row 2:
      1. Field: Origin
      2. Value: Email
    9. Click Add Field
    10. Row 3:
      1. Field: ParentId
      2. Value: {!$Record.Id}
  4. Click Done.

In the end, Corey’s Flow will look like the following screenshot:

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 55
  5. Interview Label: Auto Create Child Case {!$Flow.CurrentDateTime}
  6. Click Save

Almost there! Once everything looks good, click the Activate button.  

Proof of Concept

Now onwards, when a Case is created, Salesforce Flow will automatically trigger and create a child Case whenever the Case Reason = Breakdown. Let’s test it out.

  1. Now create a new Case with Case Reason – Breakdown. You can follow the screenshot below:
  2. Once the Case is created, click View Case Hierarchy.
  3. A child Case record is automatically created with the desired field values that we set in the Create Records element.

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!
Preferred Timing(required)

65 thoughts on “Automatically Create a Record from a Flow

  1. Thank you @ Rakesh Gupta ! It works ! I just need to understand why when, for example, the number variable equals to 12, I have 36 payment records created, when the flow is triggered (even if I use the assignement “subtract value” to reach 0)

  2. Hello

    I want to create multiple related records, I don’t understand what I have to put in Record Collection (after checking the box Multiple on Create Record).
    In my example, I would like create multiple Payment Records when the status of Invoice is equal to Posted (the number of payments depends of a number field in Invoice)
    Can you help me please ?

    1. I’m happy to help. I’ve penned an article on a similar topic before, but I can’t locate it at the moment. Nonetheless, here are my thoughts:

      1. Create a number variable in Flow (default value – number from invoice)
      2. Check if number variable is greater than >0
      3. If yes, then use (record variable type payment) in an assignment element to store all values
      4. Add the record variable type payment to a record collection variable
      5. Subtract 1 from number variable created in Step 1
      6. In the end, use create record element to create payment records

  3. In immediate action when you give parent case id then in value its not accepting [case].id. it is asking gor 15 or 18 salesforce id. getting error

  4. I have created a custom object called Training Records.Data (Come from LMS) for custom objects I pulled into reports.
    Also, I need the data from certain custom fields of custom objects to get visible in contacts page, made a custom section called Training records(with the same name as custom object) in the contacts page.
    Basically, I need the data to get populated from custom objects to the custom section-I fail here.
    Any help/suggestions would be appreciated?

  5. Hi Rakesh!

    Great resource.

    I successfully created a child record based on a specific condition using process builder.

    Is there a way to prevent the creation of additonal child records if one already exists?

    Thank you,


  6. Hi Rakesh,

    I have Lead Object , and 2 custom objects(Master Detail relationship between them) ..a junction object

    I’ll like to create both objects A&B records when Lead record is created.


  7. Hi Rakesh,

    In case of child case record created when creating a case , is there a way for me to send an email to user but with details of Case Id of the child record created rather than parent record.

    If I use case ID , it shows the parent Case Id (first case created ) not the child record Case id.

    1. You have two options

      1. Create another process on case, use it to send email alert
      2. Move child case creation process to Flow and then move email alert + Case Creation there

  8. Hi Rakesh,
    Many Thanks for wonderful blog, however, can you suggest how can we work out this requirement using process builder(as this might require creation of more than one record):
    A number of child cases records that will derive their desc and statuses etc. from related Parent case should be created automatically, may be based on a number of child records to be created specified over a field on the case record.Any help would be appreciated.


    1. Thanks for your feedback Sakshi!

      If you want to create number of child cases based on value specified over a field, then follow the steps below

      1. Use Record Lookup on parent object to get the record ID, Field (Where the number of child cases to be created is specified), and other fields you want to copy.
      2. Then use Loop element to iterate through #number field
      3. Use assignment element, to assign all data in one Sobject variable
      4. Then use another assignment element to assign Sobject variable to a Sobject Collection Variable
      5. At the end, use Fast Create to insert all child cases
  9. Hi Rakesh,

    Your tutorial is really nice, one suggestion from my end is put popup functionality to the screenshots so that user can view screenshot directly from your site.


  10. [Case].Id is not accepting by process builder its throws an error “The value for this field type must be a 15- or 18-character Salesforce ID. For example, 5003000000D8cuI.”

  11. Hello. I have to custom Objects. Object 1 is the parent of Object 2 in a master-detail relationship. Is it possible for me to create a record in Object 2 automatically if a record in Object 1 is created and has a certain status?

  12. Hello sir ,
    I have a query
    I have a two process on same custom object

    First process will fire whenever a new record is created and than action i defined is specific approval process . after approved it will change check box from false to true.

    CONDITION – Object*
    opp custom

    Start the process* -only when a record is created

    second process is having condition(Credited or edited) on same object that whenever check box is true it will create opportunity

    CONDITION – Object*
    opp custom

    immediate ACTION – created OPPORTUNITY

    when i create record first process fire and record is submitted for approval after this when i approved the check box changes from false to true but my second process isn’t Firing however if i manually simply click edit after step one AND SAVE than second process fire (isn’t it fire automatically when check box changes its value AFTER UPDATE FROM APPROVAL THROUGH first process).


  13. Tried to create the flow diagram for the process however, when I click the link it takes me back to the Process Builder page instead of the Flow detail page.

  14. Thanks for posting this, Rakesh. Question for you – on Step 5 where we are setting the Object Variables, what is happening when setting the Parent Case ID to Case ID? I assumed it would’ve been set to Parent Case ID, no? Thanks for your help in clarifying.

  15. Is it possible to create a new Opportunity when one is marked as closed/won? I know that I can create a record, but can I use Process Builder to populate information (for example: Close Date of previous Opportunity) in a new Opportunity when the old one is closed?

    1. Yes, you can map Close date of new record to Close Date of previous Opportunity Example at Getting Started with Process Builder – Part 7 (Auto Create and Activate the Contract ). But same time if you want to map Close Date of new record to Close Date of previous Opportunity Plus 10 or 20 Days, In this case you have to create a Formula field in your object and then map this formula field with Close date field Example at Getting Started with Process Builder – Part 3 (Clone a record)

  16. I have two objects custom1 and custom2. In custom1 when status is changed I am creating a record in custom2 using process builder. Is there any option to get related attachments of custom1 object in custom2 object using process builder.

Leave a Reply

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