JIRA Transition Validator in the form of JQL

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

This widget could not be displayed.
Henning Tietgens Community Champion May 05, 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

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 Community Champion May 06, 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.

This widget could not be displayed.
Daryl Chuah Atlassian Team May 05, 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 :)
This widget could not be displayed.
Daryl Chuah Atlassian Team May 05, 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 :)

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.

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.

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

This widget could not be displayed.

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

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

264 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you