How to Add Record Type in Salesforce Flow

In Salesforce flows, we can add record types to the flow and create records using record types with different page layouts for the same object.

In this Salesforce tutorial, we are going to learn about adding record types in Salesforce Flow. In that, we will see the record type in Salesforce and how to create records using the record type in Salesforce flow with the real-time scenario and explanation.

Record Type in Salesforce

What is the Record Type in Salesforce

In Salesforce, sometimes, we need to create different page layouts for different purposes for the same object. The record types control the page layouts and picklist values.

It is a way of grouping many records of one type for that object. We can add a record-type Standard object as well as a Custom object.

After adding the Record Type in the flow, we will see How to create records using these record types.

Example of Record Type in Salesforce

We will see how we can use these record types in the Salesforce Flow. Let’s consider the following scenario:

While working as a Salesforce Admin for a US-based Organization that provides software solutions, I was assigned the task of registering users in three domains: Salesforce, Sharepoint, and Python.

Since the required field to register a user was different in each domain, we had to create separate page layouts for each domain with different record types.

How to Add Record Type in Salesforce Flow

We can add record type in a Salesforce Flow using the above scenario and the following steps.

Pre-requisite: We need any standard or custom object with a record type. As per our scenario, I have a custom Employee_c object with the Salesforce, Sharepoint, and Python technologies record types.

1. Log in to the Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.

Create Record Type in Salesforce Flow

2. Then, click on the New Flow button to create a new flow.

Create Record Type in Salesforce Flow

3. In this scenario, we will create records using Record Types, so we have to create a screen flow. Here, you can see we have the Screen Flow type. Click on it and then click on the Create button.

Create Record type in Salesforce Flows

Create Flow:

4. The image below is a flow reference that we are going to create to add the Record Type.

What is Record Type in Salesforce Flow

Now, we will create the flow components referred to in the above image. To do that, follow the steps below.

See also  How to Create Roll-Up Summary Field using Salesforce Flow

1. Add Screen Component:

1. Now, we have to add Record Type to the screen. To do that, click on the Elements tab from the Toolbox. You will see the Screen element under the Interaction drag and drop screen component on the Canvas.

Create a Record type in Salesforce Flow example

2. After adding a screen to the canvas, enter the Label, and the API name will automatically populate. It will need to give reference to the other variable. Scroll down to add other details.

Create Record Type in Salesforce Classic Flow

3. Then you will see the Choice. Here, we will add the Record Type we created in the Object Manager. To do that, click on the New Choice Resource.

How to Create a Record type in Salesforce Flow example

4. When you click on New Choice Resource, you must add Record Type to the picklist field. To do so, click on the Resource Type and then select the Record Choice Set option. Then, Enter the API name; the Description is optional. Then, as we want record type values from the org in the Object Field, we have to select the Record Type object.

How to Create a Record type in Salesforce Flow

5. Now, we need to select the object from which we have to get the record type values and add those values to the picklist. For that, on Field, select Sobject equals to value as our object Employee_c.

How to Create Record Type in Salesforce Classic Flow

6. Then, in the Choice Label field, we have to select the Name of the record type because this Label will display on the screen. The datatype will be Text. The Choice Value must be ID because, behind the scenes, all the operations will be performed with ID only.

See also  How to Use Decision Element in Salesforce Flow

After that, pass this ID to the Picklist API name. Then click on the Done button.

How to Create Record Type in Salesforce Flow

2. Get Records Component:

1. Now, we want the Record Types value from an object. To add the Get Record Element, click on the Elements tab from the Toolbox. You will see the Get Records element under the Data Component drag-and-drop Get Records component on the Canvas.

2. For that, we have to select the Record Type object. Then, we need to pass the record type ID to the Picklist values that we have created for the retrieved record type values. Also, pass the Sobject as our employee_c object. Using that, we are adding record type to the flow.

How to Create Record type in Salesforce Flows

3. Add Screen Component:

1. Now, we have to add a field to the screen, and for that, we have to add another screen to the canvas. To add the screen again, click on the Elements tab from the Toolbox. You will see the Screen element under the Interaction drag and drop screen component on the Canvas.

2. After adding a screen to the canvas, enter the Label, and the API name will automatically populate. It will need to give reference to the other variable. Scroll down to add other details.

3. Then add all the required fields along with the fields that you want to include to create the record.

Add Record Type in Salesforce Flows

4. Create Screen Component:

1. After Creating the screen, we have to Create Records using the fields that we added to the screen component.

2. To create a record, click on the Elements tab from the Toolbox. You will see the Create Records element under the Data component drag and drop screen component on the Canvas.

3. Then, in the How Many Record to Create option, select One because we will create only one record at a time. In How to Set record fields, select Use separate resources and literal values because we are creating only necessary fields. For that, we have mapped the fields with the fields that we created in the Screen component.

4. Then, in the Object field, select the on which object you want to create records. Here, I have selected the Employee_c object.

Add Record Type in Salesforce Flow

5. Then, we need to set field values for the employees. That means we need to map the Employee_c object field with the Screen Components fields, as I have mapped the following fields.

See also  How to Create a Note with Salesforce Flow

Along with this field, we have to map the Record type Field with the Get Employee Component ID because we have stored the Record ID in that component. After that, click on the Done button.

Add Record Type in Salesforce Lightning Flows

5. Save Flow

1. After setting up all labels and conditions, click the Save button to save the flow. For that we need to enter the Flow Label; here, I have entered the Add Record Type in Flow. The API Name will automatically populate as we click the text box. The Description is optional; we can enter a short intro about our flow.

Then click on the Save button.

Create Record Type in Salesforce Lightning Flow

2. It is best practice in the flow to always Debug the flow before activating it, and then, if no error occurs, Activate the flow.

Here, you can see when I click on debug in the picklist field, all Record Types that I have created on the Employee_c object are displayed in the flow screen.

Add a Record Type in Salesforce Flow

This is how we can add a Record Type in the Salesforce Flow and create records according to it.

Conclusion

I hope you have got an idea bout about creating record types in Salesforce Flow. In that, we have seen the record type in Salesforce and how to create records using the record type in Salesforce flow with the real-time scenario and explanation.

You may like to read: