Learning Salesforce Visual Workflow and Process Builder(Second Edition)
上QQ阅读APP看书,第一时间看更新

Adding a choice to a Flow

Now we are going to add the third field; that is, Rating. To add a Choice element, follow these instructions:

  1. For rating, we will use the Radio Buttons field. Double-click on the Radio Buttons field, which is available under the CHOICES section. In the Screen overlays preview pane, click on the Radio Buttons field to configure its settings by entering Label, Unique Name, Value Data Type, 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 Choice, as shown in the following screenshot: 
  3. A new window will pop up where you have to enter Label, Unique Name, and Value Data Type. For Stored Value, use 1 and uncheck the Show Input on Selection checkbox, as shown in the following screenshot:      
  1. If you leave Stored Value blank, then, in runtime, if the user leaves a choice blank or unselected, its stored value is set to null. If you select the Show Input on Selection checkbox, then the user input field appears below the choice option. This option is not available if the choice's data type is Boolean. Repeat the same process and create choices 2, 3, 4, and 5, and use 2, 3, 4, and 5 as the stored values, respectively, as shown in the following screenshot:
  1. Use Add Choice to add multiple choices.
  2. Once you are done, click on the OK button.  
You can also create a choice from the Resources tab, double-click on Choice, which is available under the CREATE NEW section, and use it with radio buttons, drop-down lists, multi-select checkboxes, and multi-select picklists as Choice.
  1. The final task is to connect all the elements using connectors. As we are using the Decision element, when you connect the Decision element Check Age to the Screen element Feedback form, you will get an option to select the outcome. In this case, select Greater than 18, as shown in the following screenshot:
  1. Navigate to the element that you want to use as the first screen in your Flow. Now, set the Screen element Enter your age as the Start element, as shown in the following screenshot:
  1. Save the Flow with the name Displaying feedback form based on age and click on the Run button to test your Flow. Now, enter any date on the screen:      
  1. Once done, click on the Next button, as shown in the preceding screenshot. If the age difference is greater than 18, then it will display the feedback form, as shown in the following screenshot:
  1. Finally, click on the Finish button and it will redirect you to the first screen. We will discuss the concepts related to exposing the Flow for unauthenticated access in Chapter 3, Manipulating Records in Visual Workflow.