How to use Value Lists in a FlowLast Updated: 06/29/2018 Introduced in Version: 2.0
A Value List is a basic entity that contains an enumerated list of strings like those found in a drop down menu. These can be defined statically or as a string list within a component. To make a list that is universally accessible by all flows you can create a Value List.
The goal of this example is to:
- Create a simple value list representing task priorities.
- Create a flow to use the list.
- Execute the flow.
Navigate to the Decisions Studio portal. Expand the System > Designers folder and click on the Data Structures folder.
To create a new Value List, click All > Add > User Defined Types and select Value List from the pop-up menu.
In the Add Value List [Enum] window, set the Type Name as Priority Level.
Next we have to add items to our Value List. Since we know what values we want our list to contain we can select the Bulk Add option. Select Done.
Select Create Value List.
The Value List is now available for use.
Note: It is important to collect the Data Type Full Name for this list. It will be used when we create our flow. To find the data type full name, select the newly created value list entity and view the detailed information in the Data Panel.
Navigate to a Designer Folder and click on the Create Flow button.
In the resulting New Flow popup window, name the flow and click OK.
The first step is to get the Value List that was just created. To do this, in the Flow Designer Quick Add window expand the Integrations > All Integrations > Internal Services > Data Structure Services categories and select Get Enum Values By Name component. Click Add to add it to the workspace.
Select the Get Enum Values By Name step and under Inputs > fullName define the Mapping Type as Constant. In the Value field, enter the Data Type Full Name that was collected earlier in the example.
For visual purposes, this example will display the different items in the Value List as popup notifications to the user. To do this will need to use a ForEach Step. In the Steps panel go to Flow Management and select a ForEach Step component to add it into the workspace.
In the Edit Step dialog of the ForEach Step, under Data > Type, select String from the drop down menu.
In the Inputs section, click on the Mapping Type drop down menu and select the Select Value option. Then click on the Pick button and in the resulting popup window, select GetEnumValuesByName_Output and click Pick.
Now, in the Toolbox Panel, go to Communication and select a Send Notification component and add it into the workspace.
Select the Send Notification step and in the Edit Step dialog select the Add New button in the Notify To > Notify User section.
In the resulting Pick Entity dialog, select the user to be notified and click the Pick button.
Next, configure the inputs to the Send Notification step. Under Inputs > Message, select the Text Merge.Plain from the drop down list. Then click the Show Editor button for the Merged Text item.
In the resulting Merge Text Editor popup window, hover over Item and click Add. Close the Editor.
Finally, in the Inputs section, under the Subject section, set the Mapping Type to constant and name the Value field “Enum Flow”.
Ensure all of the flow steps are properly connected and correct any validation errors that exist.
To verify the flow is properly configured, click on the Debug button at the top of the screen.
When the debugger finishes, the execution path is highlighted and the notifications are displayed on the screen.