get/evaluate workflow condition via scripted field

Hi All,

This may not be possible but what i want to do is effectively show on the issue screen why a conditional transition is missing without duplicating the condition from the workflow into a script. So ideally i want to be able to get the workflow the issue is using, find the correct linked status and then interrogate the transitions from the status to return the conditions on each transition and then interrogate those in turn? I'm not entirely sure this is feasible. Could someone provide some advice regarding this?

I've been looking through the JIRA apis but i just can't see how to get those conditions to even begin to fathom how to interrogate them. I think i am just missing something obvious here that suggests you cannot do this from a scripted field, if this is the case confirmation would be great.

Thanks in advance!

1 answer

1 accepted

1 votes

It's doable, you can get the workflow descriptor from the issue, get the current state, find all outgoing actions, and get their conditions.

Then you need to call passesCondition for every condition, and retrieve the result, then you can format it nicely. It will probably work fine, but I don't really recommend it because the code to get the value from a field runs so often. I can find example code if you need it though.

I would recommend writing a plugin with an issue tab panel, whose code only runs when the panel is displayed. If you have money, I've tested this plugin, and it works:

Thanks Jamie, i wasn't aware of that plugin but as you say it looks like it does what we need and looks a better option than the scripted field. I'll give it a go. Thanks a lot!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,149 views 13 19
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot