Hi Folks, In this post, I’m going to discuss how you can get the record type id dynamically using Salesforce flow.
In the previous post, we discussed how you can display a record type picklist on a Salesforce flow screen.
You can check the post show a record type picklist on a Salesforce flow screen
As we want to fetch a particular record Id, we will drag the GET RECORDS element to the canvas.
Because we are demonstrating this example on the Account object, select “Record Type” under the object label.
In order to get the record type Ids of the Account object, provide sObject type as “Account”.
Under the object label, you need to select the object from which you want to fetch the records.
Once you select the object you can filter the records to be fetched as per your scenario requirements.
Use the GET RECORD element to have a picklist with a Sort Order label.
It allows you to select the order in which you want to fetch the records.
The records can be fetched either in ascending, descending or not sorted order.
Now drag the screen component to the canvas.
We will add the text element to the SCREEN component because the name is a mandatory field while creating an Account object record.
Make the field as required on the screen flow.
Want to Learn Salesforce Flows? Checkout our Salesforce Flow Course
Now we will use CREATE RECORDS elements to create an Account object record and after selecting the object we need to map the data provided by the user with the object fields.
Map the Name and RecordTypeId fields with their respective values.
While editing the CREATE RECORDS element we can select whether we want to create a single record or multiple records using this flow.
BUSINESS SCENARIO – The user at SalesforceGeek should be able to get the Account object record type dynamically.
For more details and the complete solution to the business, scenario check out the video