Excerpt |
---|
A workflow validator that is based on the result of a Jira expression. |
If the Jira expression returns false
, a validation error message will be displayed. This can be used to test or compare issue fields, to test linked issues, to check for open Sprints, etc.
To add the 'Build-your-own (scripted) Validator' to a transition:
Click Edit for the workflow that has the transition you wish to configure the condition on.
In the Workflow Designer, select the transition.
Click on Validations in the properties panel.
Click on
Add validation
.Select
Build-your-own (scripted) Validator
from the list of conditions.Click on
Add
to add the validator on the transition.Input a Jira expression in the
Jira expression
field.Input a message in the
Error message
field to display if the configured conditions are not satisfied.For information on how to write a 'Jira expression' see How to insert information using Jira expressions.
Click on
Add
to add the condition to the transition.
When you add this validator to a transition and trigger the transition, the add-on checks the result of the Jira expression. If it returns true
the validation will pass. If it returns false or
any non-boolean value, a validation error message is displayed.
Use case
A typical use of this workflow validator is to validate that the field of the issue has a specific value or the current user belongs to a specific group during the transition. Consider a use case where you want to block the user from triggering the “Approve” transition when the current user is not in the “Approvers” field. To configure this:
Add the “Build-your-own (scripted) validator” to the “Approve” transition
Input the following code under “Jira Expression”
Code Block !! issue.customfield_10002 && issue.customfield_10002.some(it => it == user)
Note | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Avoid Jira expressions errorsWhen a Jira expression throws an error, Jira considers the result as
|