With conditional fields, you can manage dependencies between parent and child fields. You can set conditions for the parent fields and can manage to display child fields if those conditions are met.
In this article, you will learn to add conditional fields to your activities and use those activities in your Flows.
Creating Conditional Fields for an Activity
You can create conditional fields for your activity in the App Connector Builder (version 3).
Step 1: To start creating conditional fields for your activity, go to the Connector tab in your account.
Step 2: Choose the connector for which you want to create conditional fields.
Step 3: Go to the Activity section and select an Activity or create a new one, shown above.
Step 4: After configuring the rest of the fields of your activity, click on the Add Activity Field button. The conditional fields are applicable to radio buttons, checkboxes, and dropdown fields. Select a parent field from the afore-mentioned field types. For the sake of an example, we'll add dropdown field as the parent field.
Whenever you add an Activity field, a Textfield is selected by default. You can change the field type by clicking the Settings button and then selecting your required field type from the menu, shown above.
Click anywhere on the selected field to configure your parent field.
After configuring the parent field, you'll see the Conditional Fields section where you can configure the child fields. But first, you have to create child fields.
Step 5: Click on Add Activity Field to add as many child fields as you want.
Make sure to enter a unique Machine Name for all of the child fields you create for your Activity.
Create all your child fields likewise.
Step 6: Next, go to the parent field to configure the conditional fields. You will configure the child fields that would show up for a specific value.
In this example, we are configuring a dropdown field, Select Action. The dropdown menu contains four actions, Add to List, Remove from List, Add Tag, and Remove Tag. We'll configure the child fields based on the option selected.
In the Value field, add the options you want to show in your dropdown field's menu. For each Value field, you have to enter the Machine Name in the format ["machine_name"] of the child field you wish to show when the respective option is selected for the parent field.
For example, when the value Add to List is selected in the parent field, we want to display the List child field. Therefore, we'll add the Machine Name of the List field in the format ["listed"] for the value Add to List. Similarly, when the value Add Tag is selected in the parent field, we want to display the Tag child field. Therefore, we'll add the Machine Name of the Tag field in the format ["tag"] for the value Add Tag.
You can also display multiple child fields when a value is selected in the parent field.
For example, if you want to add a value "Add to List and Add Tag", you can add machine names for both the List and Tag fields in the format shown above.
Step 7: After you're done, scroll down to test and save your configuration.
Using Activities Having Conditional Fields in a Flow
In the running example, we configured the conditional fields for an Action type Activity. Therefore, here's how we'll design our Flow.
Step 1: To add an Activity having conditional fields to a Flow, go to Flows and select a Flow or create a new one.
Step 2: Add the Trigger step.
Step 3: Click on the kebab menu to add a child step.
Step 4: Select the App Connector for which you configured the conditional field.
Step 5: Select the Action having conditional fields and connect your account.
Step 6: Click on Continue.
Step 7: Next, you can test your configuration by selecting an option from the field menu, shown above.
For example, if we select the Add Tag option from the dropdown menu, the Tag field will appear next.
Upon completing your Flow, you can preview it to see how your end-users will see this step while creating an integration.
Select an option from the field.
The next field will appear based on the previous field's selection.