Last Updated on April 16, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
How do you automatically create a record using Salesforce Flow?
Objectives:
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:
- Define Flow properties for record-triggered flow
- Add a decision element to check if the case reason is a breakdown
- Add a create records element to create a child case
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
- Object: Case
- Trigger the Flow When: A record is created or updated
- Set Entry Criteria
- Condition Requirements: None
- Optimize the Flow For Action and Related Records
- 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.
- On Flow Designer, click on the +icon and select the Decision element.
- Enter a name in the Label field; the API Name will auto-populate.
- Under Outcome Details, enter the Label the API Name will auto-populate.
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- Row 1:
- Resource: {!$Record.Reason}
- Operator: Equals
- Value: Breakdown
- Row 1:
- When to Execute Outcome: Only if the record that triggered the flow to run is updated to meet the condition requirements
- 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.
- On Flow Designer, below the Breakdown node, click on the +icon and select the Create Records element.
- Enter a name in the Label field; the API Name will auto-populate.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- Object: Case
- Set Field Values for the Case
- Row 1:
- Field: Status
- Value: New
- Click Add Field
- Row 2:
- Field: Origin
- Value: Email
- Click Add Field
- Row 3:
- Field: ParentId
- Value: {!$Record.Id}
- Click Done.
In the end, Corey’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 55
- Interview Label: Auto Create Child Case {!$Flow.CurrentDateTime}
- 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.
- Now create a new Case with Case Reason – Breakdown. You can follow the screenshot below:
- Once the Case is created, click View Case Hierarchy.
- 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.
Thank you @Rakesh Gupta ! Finally it works! Thank you very much for your help 🙂
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)
Please share your flow screenshots via email. I will check it out.
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 ?
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
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
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?
Awesome Content!
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,
REne
Yes, for better control use Visual Workflow here to check the logic of child record.
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.
Thanks
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.
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
Thanks a lot for putting this across. This really helps.
🙂
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.
Sakshi
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
there is no option of flow in dropdown
Use Flowcomponent
At the end of this article, I will show you how to view Flow and Workflow action created by System for Process.
I’m unable to implement the above mentioned step.
It is no more applicable as Salesforce has removed this feature.
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.
Thanks,
Ram
Pop-up is not possible as the blog is hosted on wordpress.com. But i have update the images dimensions
[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.”
Could you please post a screenshot of your Process ?
Thank you for reply. I am not able to post screenshot. There is not attachment button here.
I appreciate for your knowledge sharing and quick reply.
please email me at info@automationchampion.com
Excellence It is working perfectly after your suggestion. I thought it should be referred by ID. Thanks a lot.
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?
Yes you can achieve it with help of Process Builder. In process builder select action create a record (select immediate action)
Hi Rakesh,
In this example if I retain the Case origin of parent case in the child case , how should I implement this?
Then in such cases, you have populate child case Origin from Parent case.
Simply Wonderful!!!
Thank you 🙂
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
IMMEDIATE ACTION – SPECIFIC APPROVAL PROCESS
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
START THE PROCESS – WHEN A RECORD IS CREATED OR EDITED
CRITERIA FOR ACTION – WHEN CHECK BOX = TRUE
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).
WHEN THERE IS UPDATE IN CUSTOM OBJECT FROM APPROVAL PROCESS WHY ITS NOT COMING UNDER MY SECOND PROCESS CRITERIA
Please make sure that you have selected “are-evaluate workflow rules after field changes” for approval process field update
Thanks a lot sir It works and your blog is awesome
Thank you!
Thank you 🙂
Good sir,you are serving a lot
Good ,thanks for helping to others
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.
This behaviour changed recently. it It means back-door access to the Flow Behind the Process is no longer available
Yes …just found that out myself …but thanks Rakesh for providing this excellent guide
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.
Yes, to set parent Case ID
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?
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)
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.
As per my understanding you have to use Flow and Process Builder both to achieve it.
How i can achieve using both?
Can you further elaborate on what you would like to achieve ?
Awesome!
Thanks!
Cool Rakesh
Thanks Adam:)
You are simply awesome Rakesh!
Thank you 🙂
Thanks alot, man!
🙂