Record Types
With the ultimate version of the Flow Data Table, you can configure picklist editing with values configured for record types.
In this guide, we will extend the flow from the getting started guide to allow the user to select a record type, filter the retrieved records by that record type, and allow the user to edit a picklist field which is configured with different picklist values for each of the two record types.
If any of the above is confusing, do not worry. We are going to cover the steps in detail below.
This guide assumes you have some basic knowledge of Salesforce record types. If you have never used them before, or are not familiar with them, we suggest reading the following on the topic at Salesforce Help Page
Create Record Types
Create account record types and assign picklist values as described in the Create Record Types Trailhead exercise.
After you complete the Create Record Types trailhead exercise, assign account records to each of the two records types. You can do this by going to an account detail page, click the drop down in the upper right corner, and select Change Record Type. To verify you have records assigned to the record types edit a list view to filter on the two records types:
Modify the Flow
Go to the Accounts flow you created in the getting started guide and perform the following steps.
Create Record Type Flow Variable
This variable will hold the record type id for the selected record type. Follow these steps to create the variable:
- On the left side under Toolbox select Manager
- Click New Resource
- Configure the form as follows:
Resource Type: Variable
API Name: RecordTypeId
Data Type: Text
- Click Done
Create a Record Choice Set
A record choice set will retrieve the account record types and allow you to configure them as radio buttons on a flow screen.
- On the left side under Toolbox select Manager
- Click New Resource
- Configure the form as follows:
Resource Type: Record Choice Set
API Name: RecordTypeChoices
Object: Record Type - Under Filter Record Type Records configure as follows:
Condition Requirements: Conditions are Met
Field: SobjectType
Operator: Equals
Value: Account
- Under Configure Each Choice configure as follows:
Choice Label: Name
Data Type: Text
Choice Value: Name
Field: Id
Variable: {!RecordTypeId}
- Click Done
Create Record Type Screen
This screen will allow the user to select the record type.
- On the left side under Toolbox select Elements
- Drag a screen element onto the flow
- Under Screen Properties set the values as follows:
Label: Select Account Type
API Name: SelectAccountType
- Drag a Radio Buttons component onto the screen and configure as follows:
Label: Account Types
API Name: AccountTypes
Require: Checked
Data Type: Text
Choice: {!RecordTypeChoices}
- Click Done
- Place the Select Account Type screen between the Start and Get Accounts steps. Your flow should look like the following:
Modify Get Records
Modify the Get Records step so that only records matching the record type are read from the database. Also read in fields that were added to the field set:
- Open the Get Records flow element by double clicking on it.
- Under Filter Account Records set the form properties as follows:
Condition Requirements: Conditions are Met
Field: RecordTypeId
Operator: Equals
Value: {!RecordTypeId}
- Click Done
Pass Record Type to Data Table
Pass the record type value to the data table so that it presents the appropriate picklist values during editing.
- Open the Account Table flow element by double clicking on it.
- Click on the Flow Data Table, scroll down, and set properties as follows:
Table Mode: In Memory Edit
Record Type Id: RecordTypeId - Scroll down and click the Configure Fields button
- Add the fields Type, RecordTypeId
- Click Save
- Click Done
- Save the flow
Run the flow. Select an Account Type and hit next. When you edit an Account Type field in the data table the available picklist fields in the drop down should match the values configured in Setup for that record type.
If the data table does not contain any records then go to some account detail pages and assign record types as described earlier in this exercise.