Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

A workflow validator which ensures that the specified fields have a value during a transition.

If any of the specified fields is empty, an error message is displayed and the user is forced to input a value. You can customize the error message to be displayed when the validation fails.

To add 'Field is required Validator' to a transition:

  1. Click Edit for the workflow that has the transition you wish to configure the validator on.

  2. In the Workflow Designer, select the transition.

  3. Click on Validators in the properties panel.

  4. Click on Add validator.

  5. Select Field is required Validator from the list of validators.

  6. Click on Add to add the validator on the transition.

  7. Input the field names in the Fields drop-down.

  8. Input a message in the Error message (optional) field to customize the error message.

  9. Click on Add to add the validator to the transition.

When you add this validator to a transition and trigger the transition, the add-on checks for a value in the selected fields. If no value is found, then an error message (configured/default) is displayed.  You can insert the missing field name in the customized message using %field% place holder. For example, if your validator is configured to check Fix Version/s and Due date fields with this customized error message:

Code Block
%field% is required. Please enter it

then the message is displayed below both the fields on the transition screen (at the top if they are not on the transition screen).

Also, you can identify the field that is required with a red asterisk suffixed to the title of the field. 

Validator Scope

To execute this validator based on the result of a groovy expression see Conditional execution using Groovy expression

Show asterisk (*) if the condition returns true upon showing the screen

By default, the red asterisk is not shown on the screen against the selected fields when using Conditional Validation, because the condition's value might depend on what the user will later enter on the transition screen. Check this option to show the asterisk if the condition returns true upon entering the transition or issue creation screen. This is useful when the condition is not dependent on the other fields shown on the screen (e.g. it only depends on the issue type, the current user's project role, etc.).

Info

On the Create Issue transition (Create Issue screen), the issue variable is null when the screen is first opened, because no issue yet exists. Therefore, if the Conditional Validation script refers to the issue variable, the script will throw an Exception and no asterisk will be shown. However, validation will be performed normally when submitting the form.