A script validator is a powered-up version of a standard Jira validator. Instead of using one of the basic validators that you find in Jira, you can run a script to validate your issue. If the script returns
false the script does not transition until all errors are resolved, for example, filling in the required fields. Validators allow administrators to determine what error message is displayed to the user. So, a scripted condition gives you more options to control this part of the workflow.
ScriptRunner for Jira Cloud provides workflow validators using the Jira Expression Framework. It is not possible to use the REST API.
There are several ways to enhance your workflow using script validators, including:
Require a Fix Version if the resolution value is set to Fixed.
Require a comment when the resolution is Wont Fix.
Ensure all at least one sub-task is In Progress if the resolution of the parent issue changes to In Progress.
Remember, a validator checks to see if the user can transition an issue, they don’t prevent the next transition button from appearing (that is a script condition).
Select the transition you wish to add the validator to.
Click Validators→Add Validator.
Select the ScriptRunner Script option then Add.
Enter the Name of ScriptRunner Script Validator.
In the ScriptRunner Script Validator field, enter the script validator expression. This script validator must be written as a Jira expression.
Type an error message to show when the validator fails in Message to Show when Validation Fails.
For help navigating to ScriptRunner workflow functions, follow the steps to navigate to workflow functions.
Select the transition the validator is on.
Click Validators. A list of all validators on the selected transition is shown.
To edit an existing validator, click the Pencil.
Edit the validator and click Update.