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 returnsfalsethe 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 theJira Expression Framework. It is not possible to use the REST API.
There are several ways to enhance your workflow using script validators, including:
Require aFix Versionif the resolution value is set toFixed.
Require a comment when the resolution isWont Fix.
Ensure all at least one sub-task isIn Progressif the resolution of the parent issue changes toIn 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 ascript condition).
Add Validator
For help navigating to ScriptRunner workflow functions, follow the steps in the Example Workflow Extension.
Select the transition you wish to add the validator to.
ClickValidators→Add Validator.
Select theScriptRunner Scriptoption thenAdd.
Enter theName of ScriptRunner Script Validator.
In theScriptRunner Script Validatorfield, enter the script validator expression. This script validator must be written as aJira expression.
Type an error message to show when the validator fails inMessage to Show when Validation Fails.
Edit Validator
Navigate to ScriptRunner → Workflows. All existing workflows are displayed as default.
Select Validator from the Type drop down list. You will now see a refined list displayed.
Click the Actions ellipsis for your preferred workflow and select Edit.