This section has use cases which help you in understanding the usage of Validators provided by JMWE.
On this page:
Linked Issue(s) validator
This validator can be used to ensure that issues linked to the current issue have certain characteristics
Sample use cases:
Prevent creation of more than 5 subtasks for a parent issue of "Story" issue type
- Add the
Linked Issue validator
to the Create transition. Select the issue link type is Subtask of from the
Issue Link Type
field.- Select the issue type
Story
from theIssue Type
field. - Select the option "Every linked issue must satisfy the condition below"
Input the Jira expression:
!!issue.parent && issue.parent.subtasks.length < 6
- Add the error message, "
You cannot create more than 5 subtasks
"
- Add the
Linked Issues Status validator
This validator can be used to ensure that the current issue's linked issues are in one of the selected statuses.
Sample use cases:
Block the transition of the Epic to Closed status, if its stories aren't closed.
- Add the
Linked issues status validator
to the Close transition. - Select the issue link type
is Epic of
from theIssue Link Type
field. Select the statuses the linked issues must be in, from
Statuses
Add the error message, "
The Stories of the Epic are not yet resolved
"
- Add the
Prevent creation of new subtasks to the parent if the parent is in "Resolved" or "Closed" or "Rejected" status
- Add the
Linked issues status validator
to the Create transition. - Select the issue link type
is subtask of
from theIssue Link Type
field. Select the statuses "Resolved", "Closed", "Rejected", from
Statuses
Add the error message, "
The parent should be in Resolved or Closed or Rejected
" status.
- Add the
Build-your-own (scripted) Validator
This validator can be used to perform a validation with a Jira expression. Based on the result of the expression, the user is either allowed or blocked to transition to the destination status.
Sample use cases:
Force users to provide Fix Version/s only when the resolution is Fixed
- Add the
Build-your-own (scripted) validator
to the Resolve transition. Write the following script in Jira expression field
issue.resolution.name != "Fixed" || issue.fixVersions && issue.fixVersions.length > 0
- Add the
Prevent the user from approving a hardware request if the respective hardware (count stored in a custom field) is out of stock
- Add the
Build-your-own (scripted)
validator
to the Create transition. Write the following script in Jira expression field
!!issue.customfield_10202 && issue.customfield_10202 > 0
- Configure the error message: Inventory out of stock.
where xxxxx is the id of the custom field holding the count of the stock
- Add the
Prevent the employee from applying for a leave if the employee is in the 3 month probation period
- Add the
Build-your-own (scripted)
validator
to the Apply leave transition. Write the following script in Jira expression field
!! issue.dueDate && issue.dueDate.plusMonths(3) > new Date().toCalendarDate()
- Configure the error message: Cannot apply for a leave
- Add the