JIRA Transition Validator in the form of JQL

Eclipse Trading May 5, 2013

I would like to run a JQL query to look up issues with certain criteria based on some fields selected on the jira (custom fields) and check if the query returns any results. If it does return results, I want to fail the validation in the transition.

Is this currently possible? If yes, please advise on how should that be done.

5 answers

1 vote
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2013

You can use Script Runner plugin as already suggested by Nic. Script Runner provides a "Allows the transition if this query matches a JQL query" script as a workflow condition. This won't already match your requirement, but it's a good starting point.

Henning

Eclipse Trading May 6, 2013

Hi Henning, so I'm now happy to use Conditions instead of Validators and I'm using Script condition and use the jqeury condition check and when i use hardcoded values, it does work, but when i try to use variables (values from custom fields) it doesn't like it..

This works well:-

(fixVersion="7.4.0")) OR (fixVersion="7.4.0" and status not in (Verified, Closed)

This doesn't work:-

(fixVersion=cfValues["Deployment Version"]?.value)) OR (fixVersion=cfValues["Deployment Version"]?.value and status not in (Verified, Closed)

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2013

Yes, thats because the second term is not a valid JQL term.

To make this possible you have to script your own condition. If you look at this answer https://answers.atlassian.com/questions/151633/bulk-changes-is-there-a-way-to-concatenate-a-new-fixversion-when-doing-a-bulk-change-as-opposed-to-completely-replacing-the-fixversion you can see how to do a JQL search in your own script. Within your own script you can read the values of the customfields and relplace them before you execute the search.

0 votes
Daniel Bengtsson September 22, 2015

My needs were resolved by using Workflow Enhancer which can add a boolean validator using various fields. This is also a free add-on. 

0 votes
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2013

Alternative: use JJupin, it has a routine to help you select the issues you want, and maybe process it ...

http://confluence.kepler-rominfo.com/display/SIL/selectIssues

0 votes
darylchuah
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2013

Hi there,

JQL not so possible however if you can try to create a transition validator based on a custom field value yes it is doable.

You can try using the following JIRA plugins which have the workflow transition validator function:

JIRA Misc Workflow Extensions

Behaviours Plugin

JIRA Suite Utilities

Hopefully it helps!

Cheers :)

Eclipse Trading May 5, 2013

Hi Daryl, I need to lookup statuses from other jiras based on criteria defined on the current jira to determine if the transition should be possible or not.

So what we do have is, say, a version and i need to lookup all bugs linked to that "version" based on a "not verified" status which doesn't exist on the current jira (and hence i need to run JQL). If there are results, the case should FAIL, if there are no results, the case should PASS.

Eclipse Trading May 5, 2013

Hi Daryl, I need to lookup statuses from other jiras based on criteria defined on the current jira to determine if the transition should be possible or not.

So what we do have is, say, a version and i need to lookup all bugs linked to that "version" based on a "not verified" status which doesn't exist on the current jira (and hence i need to run JQL). If there are results, the case should FAIL, if there are no results, the case should PASS.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2013

You'll need to find or write a validator to do that somewhere else - although the plugins Daryl mention are powerful, none of them contain a function that will cover this requirement.

Your business logic is quite specific to yourself here, so I'm not sure anyone will have written anything flexible enough to be used for it.

So, as usual, I'd recommend looking at the script runner plugin, as that can provide framework into which you can code your logic without having to write a whoel plugin

0 votes
darylchuah
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2013
Hi there,
JQL not so possible however if you can try to create a transition validator based on a custom field value yes it is doable.
You can try using the following JIRA plugins which have the workflow transition validator function:
Hopefully it helps!
Cheers :)

Suggest an answer

Log in or Sign up to answer