Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use groovy script to see if a specific transition has occurred on an issue?

Montana Fox December 10, 2020

I want to use Groovy script for a Condition to be able to tell whether/not a specific transition has ever been run on the given issue. Is there a way to iterate through the issue's transition history? Looking at the status history is not what I'm after.

So, if transition "XYZ" has ever been fired on this issue, then Condition = true.

2 answers

0 votes
Nic Brough -Adaptavist-
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.
December 10, 2020

Yes, you can do this with Scriptrunner, as it can get to the os_<table> data and hence find the id of a transition that was executed.

But it would be painful to code for, and quite a heavy load, and given that a condition can execute up to four times for every display of an issue, it's likely to load your Jira server so heavily that you will spend several days fielding "Jira is to slow to use" questions until you give up and remove it.

A Condition that looks at the status change history would be far more simple to code for, way more performant, and probably be of more use (humans really don't care about what tranisition was used, but they do care that "status changed from X to Y")

0 votes
Hana Kučerová
Community Champion
December 10, 2020

Hi @Montana Fox ,

I don't think it is possible. You are able to get information about source and target status from the history, but not which transition exactly has been used.

But maybe you can create some custom field for your condition and post function for this specific transition, which changes this custom field's value? Then you should be able to distinguish, whether the specific transition has been used.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.2.7
TAGS
AUG Leaders

Atlassian Community Events