UiPath Activities

The UiPath Activities Guide

Conditional Drop-Downs


Conditional drop-downs enable you to select an option from the drop-down, based on a previous selection made in another form component.
For example, if you select a specific state from a drop-down list, the conditioned drop-down displays the cities in that state.


To use this feature:

  1. Create a parent drop-down, by defining a workflow variable of type List<String> or Dictionary<String, String>. For example, stateList.
  2. Create a child drop-down, by defining a workflow variable of type Dictionary<String, List<String>> or Dictionary<String, Dictionary<String, String>>. For example, cityStateMap.
  1. Drag and drop the Invoke Code activity into the workflow sequence.
  2. Click Edit Arguments and add the previously created variables as In/Out arguments. Click OK.
  1. Click Edit Code. Enter the code to initialize the data and populate the drop-downs with data. For example, the following code snippet initializes the drop-downs (stateList and cityStateMap) and adds items to them.
// initialize the parent drop-down
stateList = new List<string>();
// add items to the parent drop-down

// initialize the child drop-down
cityStateMap = new Dictionary<string,List<string>>();
// add items to the HP-child drop-down
cityStateMap.Add("HP",new List<string>());
// add items to the Punjab-child drop-down
cityStateMap.Add("Punjab", new List<string>());
  1. Drag and drop the Create Form activity.
  2. Store the user drop-down selection into workflow variables. For example:
    • cityListSelected, of type List<String>—stores the list corresponding to the selected state.
    • selectedState, of type String—stores the selected state.
    • selectedCity, of type String—stores the selected city.
  3. Open the FormFieldsCollection window from the activity Properties panel.
  4. To define the drop-down fields in the form:
    • Define the drop-down fields. The Name you set is used for data binding (see Drop-down Component > Field Key tab > Property name).
    • Additionally, define the drop-down lists by appending _dropdown to the drop-down field name.
  5. In the Value column, set the user selection as follows:
    • For the parent drop-down list, use the list defined at Step 1.
    • For the child drop-down list, use the variable stored at Step 7.
    • For the parent drop-down field, use the variable stored at Step 7.
    • For the child drop-down field, use the variable stored at Step 7.
  1. Click OK.

Sample Workflow

To check the complete workflow or to have a future reference, download the XAML example below.

Updated about a month ago

Conditional Drop-Downs

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.