How do I populate a dropdown with values from a lookup table?
Cflow provides different options to populate a dropdown field – (a) providing a list of valid values directly (b) values from a lookup table (c) values from a table in an external database (d) values from a REST API call. In this article, we’ll see how to populate a dropdown field with values from a lookup table.
Let’s say in an Expense Reimbursement workflow, company and department is a dropdown field. To populate these field with values from a lookup table then follow the below steps:
Create a Lookup table:
- Click on Add Lookup from the menu to create a Lookup. Specify the Lookup name. Here the Lookup is named as Department List.
- Drag and drop the Textbox field type from the Toolbox and create a field named Company and Department. Publish the Lookup to start using it.
- Once the Lookup is published, you can access the Lookup from the Workflows menu under the Lookups tab.
- Select Workflows -> Lookups.
- Initiate the lookup to fill the values in the field Company and Department. Submit the form to create the lookup table.
To populate a dropdown with values from a lookup table:
- In a Workflow, click on the Form Designer.
- In the dropdown field Company – Validation settings -> Valid Values -> Use the following formula:
Example: #Lookup Name.Lookup Stage Name.Lookup field Name#
- #Department List.Department List.Company# – This formula will populate the name of the company from the lookup table and listed in the dropdown in a workflow.
Note: Lookup Stage Name is the Lookup Name by default.
- In the dropdown field Department -> Validation Settings -> Valid Values -> Use the following formula:
- #Department List.Department List.Department# – This formula will populate the name of the department from the lookup table and listed in the dropdown in a workflow.