Conditional actions, rules, and elements

Using rules, you can add conditional actions, such as If, And/Or, and Then to various elements in a form.

Prerequisites

For the Checkbox and Radio Button elements, the rules are triggered only if the corresponding presets are selected. For example, if a form has two mutually exclusive options, such as Yes and No, the rules associated with these options are triggered only if you select one of the two options.

Attention: Rules are not supported for the following elements:
  • Dynamic Area
  • Image
  • Select file
  • Select folder
  • Snapshot
  • Table
Note: The change label action in the form rules now applies to the Button element. This form rules will automatically apply to the button where you set the rules. The rules editor is now applicable to the Table element. The rules editor and conditions applies for each individual columns while any actions you set are applied for each row in the row level.
Consider a scenario where you are creating a user sign in/registration form. You can add a rule to one of the form elements to enable an option to sign in as an existing user or register a first time user.

Procedure

  1. On the left pane, click Automation.
    A list of available bots and forms is displayed.
  2. Click Create new > Form.
  3. In the Create form page, enter a name for the new form.
    Forms are saved in the \Bots\ folder by default. (Optional) Click Choose to change the default folder.
  4. Click Create & edit.
  5. Drag the following elements into the form:
    • Dropdown: In the Element label field, enter 'Select user type' and in the Add dropdown content field, add 'Existing user' and 'New user'.
    • Text Box: Add two elements and name them 'User name' and 'Register'.
    • Password: Add one element.
    • Button: Add two elements and name them 'Save' and 'Cancel'.
  6. On the right pane, click Form rules > Add rule.
    You can use this option to add rules to the form elements. In this scenario, add two rules.
  7. For Rule1, update the following fields:
    Rule 1 is applied when an existing user tries to sign in. If the user clicks Select user type > Existing user, the Register text box is made unavailable. Use the If menu to set the following conditions:
    1. Select user type as the element condition in the first drop-down menu
    2. Choice is in the second drop-down menu
    3. Existing user in the third drop-down menu
    Note: The If conditions are supported on the following elements:
    • Dropdown
    • Checkbox
    • Radio Button
    • Date
    • Time
    • Hyperlink
    Use the Then menu to set the corresponding actions:
    1. The Register text box in the first drop-down menu

      All the available elements in the form on which the rules are supported are listed in this field. For the Dropdown element in the Then menu, you can use the Assign option to append or overwrite values at bot runtime.

    2. Disable in the second drop-down menu
  8. On Rule1, click the vertical ellipsis (More options) for the following options:
    • Add rule below: Add a new rule below Rule1.
    • Duplicate rule: Add a duplicate of Rule1.
    • Delete rule: Delete Rule1.

      If you added more than one rule, the following additional options are enabled to toggle the rules:

      • Move up
      • Move down
      • Move to top
      • Move to bottom
  9. For Rule2, update the following fields:
    Rule 2 is applied for a first-time user. If a user clicks Select user type > New user, the User name and Password text boxes are made unavailable. Use the If menu to set the following conditions:
    1. Select user type as the element condition in the first drop-down menu
    2. Choice is in the second drop-down menu
    3. New user in the third drop-down menu
    Use the Then menu to set the corresponding actions:
    1. The User name text box in the first drop-down menu
    2. Disable in the second drop-down menu
    3. The Password text box in the third drop-down menu
    4. Disable in the fourth drop-down menu
  10. Optional: If you want to interchange the sequence of these two rules, drag Rule1 below Rule2 or Rule2 above Rule1.
    You can also click the ellipsis (…) next to Add rules to select one of the following options:
    • Collapse all: Collapses the rules. Is enabled only if you have expanded any of the available rules.
    • Expand all: Expands the rules.
  11. Click Save.
    The new registration form is created and is ready to be linked to a bot.