Conditional Dropdowns
Conditional dropdowns enable you to select an option from the dropdown, based on a previous selection made in another form component.
For example, if you select a specific state from a dropdown list, the conditioned dropdown displays the cities in that state.
Tutorial
To use this feature:
-
Create a parent dropdown, by defining a workflow variable of type
List<String>orDictionary<String, String>. For example,stateList. -
Create a child dropdown, by defining a workflow variable of type
Dictionary<String, List<String>>orDictionary<String, Dictionary<String, String>>. For example,cityStateMap.
-
Drag and drop the Invoke Code activity into the workflow sequence.
-
Click Edit Arguments and add the previously created variables as In/Out arguments. Click OK.

-
Click Edit Code. Enter the code to initialize the data and populate the dropdowns with data. For example, the following code snippet initializes the dropdowns (
stateListandcityStateMap) and adds items to them.// initialize the parent dropdown
stateList = new List<string>();
// add items to the parent dropdown
stateList.Add("HP");
stateList.Add("Punjab");
// initialize the child dropdown
cityStateMap = new Dictionary<string,List<string>>();
// add items to the HP-child dropdown
cityStateMap.Add("HP",new List<string>());
cityStateMap["HP"].Add("Shimla");
cityStateMap["HP"].Add("Solan");
cityStateMap["HP"].Add("Hamirpur");
// add items to the Punjab-child dropdown
cityStateMap.Add("Punjab", new List<string>());
cityStateMap["Punjab"].Add("Chandigarh");
cityStateMap["Punjab"].Add("Patiala");
cityStateMap["Punjab"].Add("Jalandhar"); -
Drag and drop the Create Form activity.
-
Store the user dropdown selection into workflow variables. For example:
cityListSelected, of typeList<String>—stores the list corresponding to the selected state.selectedState, of typeString—stores the selected state.selectedCity, of typeString—stores the selected city.
-
Open the FormFieldsCollection window from the activity Properties panel.
-
To define the dropdown fields in the form:
- Define the dropdown fields. The Name you set is used for data binding (see Dropdown Component > Field Key tab > Property name).
- Additionally, define the dropdown lists by appending
_dropdownto the dropdown field name.
-
In the Value column, set the user selection as follows:
- For the parent dropdown list, use the list defined at Step 1.
- For the child dropdown list, use the variable stored at Step 7.
- For the parent dropdown field, use the variable stored at Step 7.
- For the child dropdown field, use the variable stored at Step 7.

-
Click OK.
Sample Workflow
To check the complete workflow or to have a future reference, download the XAML example