Check sub-task status in Post-Function and stop from transition if sub-task still in Open status.



I have added transition in a workflow from status "In Review" to "QA Open". This transition set with option triggers "Automatically transitions the issue when a related pull request is merged".

I noticed that Triggers will ignore Conditions and Validators.

Atlassian support suggest to create groovy script to be add in ScriptRunner in Post Function.

I am quite new in creating this groovy script. Does anyone has script example to check sub-task status in Post-Function and script example to stop from proceed transition.

2 answers

This widget could not be displayed.

Hi Farhan,

This might be quite straight-forward in your use case. You could use a built-in script called "Fast-track transition an issue" with a condition added to it. That would limit the amount of Groovy that you need to write.

You can find a good example of it in the documentation

This approach works by transitioning the issue back to its original state rather than "stopping" the transition (hopefully this would work for your use case).

Here is an example of some code that will retrieve the sub-tasks for an issue that you can use in the condition field. You just need to add the condition that you want to check on and return the relevant value (see built-in examples for condition field)

issue.getSubTaskObjects().each{ subtask ->

 I hope this helps!


This widget could not be displayed.

Thanks Steve,

As your suggestion, I have created 2 transition.

  1. Transition1 for the trigger which loop back to original state. At the Post Function I use the Fast-track transition and just leave the condition blank as it will assume as true then Action to Transition2. (In this transition I add condition hide transition from user)
  2. Transition2, linked to next state with condition to check sub-task status.

It works like charm :)

Glad to hear it worked :-)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

733 views 0 3
Read article

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