Adding a Dynamic Rule to Workflow Forms

Updated

On this page

You can add rules to control various aspects of the workflow form user experience. For example, if a user enters incorrect information in a form, you can display a message. You can also show or hide inputs based on the selections or other inputs given by the user.

Procedure

  1. Choose where you want to add a rule:

  2. On the Inputs tab, click Advanced Customization.

    The Advanced Customization dialog box appears.

  3. Click Add Rule.

  4. For Match below groups when, specify when to apply the rule:

    • To reapply the rule when the user changes the value of any input field in the form, select field changes.

    • To apply the rule when the user opens the form, select form is and Opened.

    • To apply the rule when the user cancels the form, select form is and Cancelled.

    • To apply the rule when the user submits the form, select form is and Submitted.

  5. Specify when to apply the rule actions:

    • To apply the rule actions only when all the conditions are met, from the Match list, select all.

    • To apply the rule actions when one or more of the conditions are met, from the Match list, select any.

  6. Click Add condition, and then configure one or more conditions based on input values to control when to apply the rule actions.

Goal

Steps

Set a condition based on the value of the input or if the input value changes.

  1. From the inputs list, select the input.

    An operator list and a box appear.

  2. From the operator list, select the operator to use.

    For example, to set a condition for when the form contains a certain string, select contains.

  3. If the operator requires a value, in the box, enter the value to use.

Set a condition based on custom JavaScript code. The code must return a Boolean (true or false) value.

Tip: You can select form inputs using the CSS id selector (#) and the input name. For example, if the input name is UserName, you can use the JQuery selector $('#UserName') to select the input.

  1. From the inputs list, select Custom Script.

    A script box appears.

  2. In the script box, enter the function to use as the condition.

Tip: To automatically insert inputs as variables in the script, click the ellipse button to the right of the code box and then click the variable that you want to insert.

  1. Under Actions, click Add action, and then configure one or more actions to apply to the form if the conditions are met.

Goal

Steps

Show the input on the form.

  1. From the actions list, select show.

  2. From the fields list, select the field name to show.

Hide the input from the form.

  1. From the actions list, select hide.

  2. From the fields list, select the field name to hide.

Allow the user to submit the form only if they enter data into a form input.

  1. From the actions list, select require.

  2. From the fields list, select the field name to make required.

Allow the user to submit the form with or without entering data into a form input.

  1. From the actions list, select make optional.

  2. From the fields list, select the field name to make optional.

Make the user unable to enter data into a form input.

  1. From the actions list, select disable.

  2. From the fields list, select the field name to disable.

Allow the user to enter data into a form input.

  1. From the actions list, select enable.

  2. From the field list, select the field name to enable.

Automatically populate or change an input value.

  1. From the actions list, select change.

  2. From the field list, select the field name to change.

  3. In the to box, enter the value that you want to insert.

Display an informational, error, or warning message to the user that the user can confirm or cancel.

  1. From the actions list, select display a message.

  2. In the box to the right, enter the message you want to display to the user.

  3. From the top list to the right of the message box, select the type of message you want to display.

  4. From the bottom list to the right of the message box, select the confirmation options for the message.

Make the user unable to submit the form based on certain input values.

  1. From the actions list, select fail validation.

  2. In the box to the right, enter the message you want to display to the user.

Set a condition based on custom JavaScript code. The code must return a Boolean (true or false) value.

Tip: You can select form inputs using the CSS id selector (#) and the input name. For example, if the input name is UserName, you can use the JQuery selector $('#UserName') to select the input.

  1. From the actions list, select custom script.

  2. In the box that appears, enter the function to use as the action.

Tip: To automatically insert inputs as variables in the script, click the ellipse button to the right of the code box and then click the variable that you want to insert.

  1. Verify that the Enabled check box is selected, and then click OK.

    The rule appears at the bottom of the rules order list.

  2. To adjust the order of how the rule is applied, click the rule and use the up and down arrows to change the order of the rules.