EP - 05 | CREATE ACCOUNT AND RELATED CONTACT IN FLOW | LIGHTNING FLOW SERIES

 

Create Record Element

In this blog you will learn about Create Record Element in salesforce flow. As the name suggests this element is used for creating record in salesforce objects without using any line of code.
In simple terms if you want to insert some data in any object using flow then you can do it by Create Record Element.
It is same as writing insert statement in Apex.

Today's Scenario : Create a flow to ask user about account information and create an account and it's related contact record.

First we will take a screen element to get input from user. Have a look at it below :


After taking input from user we will take Create Record Element and create Account record. Have a look :

As you can see in the image above we have taken AccountId in a variable. If we need to only create account then this step will be skipped but according to the Scenario we need to create contact related to this account as well and to add that relation we will need the accountId.
Have a look at the AccountId Variable :


After storing the AccountId in the Variable now we will take another Create Record Element for creating Contact related to that Account.
Have a look at the second create record element :


In this we have added Contact in Object field because we want to insert a record in the Contact Object. After that if you will notice in AccountId field of Contact Object we have added our AccountId variable in which we already have the accountId.
For first name and last name we have taken the input field values from out first screen.
After this create record element our account and contact will be created. Just to make it a little more user friendly we have added a success screen like below :


Now have a look at our complete example in action :


If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks
Let's learn and grow together.
Love and Peace! ๐Ÿงก

Post a Comment

0 Comments