Validation on other issues numeric value
Hi, How can I create the following validation?
"Deployment task" issue type has a numerical value in CF "Deployment order" (1-10) validation should verify that there are no other deployment tasks that are not closed and have a smaller value than the value in the issue in transition before allowing the issue in question to transit to next status.
Comments (11)
-
repo owner -
reporter Hi, Currently, the only shared property is the project the issues belong to. May have other relation that can be filtered by, but not at the moment.
Thanks
-
repo owner You should use Validation based on JQL query with the following configuration:
JQL Query is:
project = %{00018} AND status not in ("Closed") AND "Deployment order" < %{nnnnn}
replacing nnnnn with field code for Deployment order.
Note that %{00018} is field code for Project key.
I have assumed that closed issues are those in "Closed" status. You can add more statuses to the list. For example: status not in ("Closed", "Resolved", "Done")
Boolean expression is:
{00058} = 0
Note that {00058} is field code for Ephemeral number 1, which contains the number of issues returned by the JQL query.
-
reporter HI, Tested it , but it does not work as expetcted
Validator:
Only if the number of issues returned by the following JQL query project = Subscription and status not in Done and "Deployment order" < %{Deployment order} (stored in "Ephemeral number 1") satisfies the following boolean expression {Ephemeral number 1} = 0. Message to show when validation fails: "Blocking Deployment tasks are not done yet".
This feature will be run as user in field Current user.Created 2 issues with Deployment order number (2 and 5)
Expected results:
- issue with Deployment order value of 2 can be transitioned (no other issues with lower number)
- issue with Deployment order value of 5 cannot be transitioned, as long as the issue with Deployment order value of 2 is not Done
Actual results:
- Both issues were able to be transition
-
reporter Can you help me? Thanks
-
repo owner You shouldn't have removed the parentheses from your JQL query, they belong to the syntax of lists in JQL queries.
Use the following JQL query:
project = Subscription and status not in (Done) and "Deployment order" < %{nnnnn}
replacing nnnnn with field code for Deployment order.
The original JQL query I provided you should also work.
-
reporter Does it matter if the CF is a select list with numbers and not a number field?
-
repo owner It will not work if it's not a numeric field.
Use "Boolean validator with math, date-time or text-string terms" with the following boolean expression:
count(filterByPredicate(issuesFromJQL("project = Subscription and status not in (Done)"), toNumber(^%{nnnnn}) < toNumber(%{nnnnn}))) = 0
replacing nnnnn with field code for Deployment order.
-
reporter This worked, Thanks!! When I tried to change the project name to %{00018}, it gave me an error, so I reverted to the original use of project name.
the error
ERROR IN BOOLEAN EXPRESSION "count(filterByPredicate(issuesFromJQL("project = %{00018} and status not in (Done)"), toNumber(^%{10219}) < toNumber(%{10219}))) = 0" : INVALID JQL QUERY IN "VALIDATION ON JQL QUERY": "project = %{00018} and status not in (Done)" : com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(37!=null)
-
repo owner To do it you should use the following boolean expression:
count(filterByPredicate(issuesFromJQL("project = " + %{00018} + " and status not in (Done)"), toNumber(^%{nnnnn}) < toNumber(%{nnnnn}))) = 0
-
repo owner - changed status to resolved
I close the issue. Please, reopen it if solution provided doesn't meet your needs.
- Log in to comment
Hi Itamar,
I imagine that the Deployment tasks you want to check up are somehow related. Do they share a same Epic? Or are they linked to a common issue with certain issue link type? Or are they subtasks of a same parent? Please, tell me the type of relationship they share.