Adding a Dynamic Record choice to a Flow

Dynamic Record choice is used to dynamically create a reusable set of choices based on a filtered list of Salesforce records. For dynamic display leads with the same e-mail address, we will use the Multi-Select Picklist field and follow these steps:

  1. Double-click on the Multi-Select Picklist field, which is available under the MULTI-SELECT CHOICES section. In the Screen overlays preview pane, click on the Multi-Select Picklist field to configure its settings by entering Label, Unique Name, the Required checkbox, and Default Value, as shown in the following screenshot:
  2. Under the Choice Settings section, create a new choice by expanding the CREATE NEW list and then clicking on Dynamic Record Choice, as shown in the following screenshot:

    A new window will pop up where you have to fill in the following options:

    • Unique Name: Enter a unique name. The name must begin with a letter and use only alphanumeric characters and underscores. Uniqueness applies only to elements within the current Flow. In this case, enter Leads as the unique name.
    • Description: Enter the description for a dynamic record choice.
    • Value Data Type: Select the data type for the choice's stored value.
    • Create a choice for each: Select the object (in this case, select Lead), whose records contain the data for the created choices.
      • Field: To filter records we select the fields. In this case, select Email.
      • Operator: This depends on the data type selected for Field and ValueIn this case, select equals as the Operator.
      • Value: This is used to compare with Field. The Field and Value for the same row must have the same data type. In this case, select {!Email_address} as the Value.
    • Choice Label: This allows you to select the record's field, whose value appears as the choice's label at runtime.  In this case, select Name as the Choice Label.
    • Choice Stored Value: This allows you to select the field, whose value is saved when the user selects this choice at runtime.
    • Sort results by: This also allows you to sort your results based on the object field and you can also limit the number of choices. In this case, use Name to sort the results.
    • Additional Options: This section allows you to assign a field's value to variables at runtime when the user chooses Field and Variable from the generated sets. In this case, map Id with your variable ({!VarLeadsID}), which we created in step 5 of the Hands on 4 - displaying related records based on search functionality section.

This will look like the following screenshot:

  1. Once you are done, click on the OK button.
You can also create a  Dynamic Record Choice from the Resources tab; double-click on Dynamic Record Choice , which is available under the CREATE NEW section, and use it with the radio button, drop-down list, multi-select checkboxes, and multi-select picklist as a dynamic choice.
  1. The next task is to connect all the elements using connectors and set the Screen element Enter the lead details as the Start element, as shown in the following screenshot:
  1. Click on the Save button, which is available in the top-left corner of the Flow canvas and enter Name, Unique Name, Description,  and Interview Label, and select Type as the Flow. Save the Flow with the name of Display leads. To test this Flow, click on the Run button and enter the e-mail address:
  1. Once you're done with the e-mail address, click on the Next button. Then the following screen will appear:
  1. Finally, click on the Finish button and it will redirect you to the first screen.