Script Runner Transition parent issue based on subtask status

Is it possible to use script runner to transition a parent issue based on the status of a subtask?

 

Right now I have this setup

  • A Request Issue type that needs to get an approval from 4 different people
  • Script runner automatically creates 4 approval sub-task when the request is submitted
  • When all the approvers mark the approval sub-task  "Rejected" or "Approved", the parent automatically transitions to the correct status (Approved or Rejected) based on all the sub-task having a resolution

My problem is this. The parent should automatically move to the "Rejected" Status whenever 1 or more of the sub-task are marked "Rejected" but this does not happen. At this point, the parent only follows the "Automatically transition the parent" based on the last sub-task transitioned. The only thing I can do is prevent the parent from moving to the "Approved" status with a transition with a condition but I cannot force the parent to transition to the "Rejected" status


Any help would be appreciated. 

5 answers

1 accepted

Nevermind. I figured out how to do it. I needed to update my version of script runner

Hey @Phillip Campbell, do you think you can share what your resolution was so that others can do the same?

What version of script runner, what built-in post-function. If not built-in, can you share your groovy code?

Thanks

@ @Phillip Campbell, could you share your script here? I would like to do something similar...

Sure.

I created a workflow on the subtask that fast track the parent's transition.

When a subtask is rejected, the parent gets the "Not approved" transition fast tracked immediately.

When a subtask is approved, the parent gets the "Approved" transition fast tracked but only when the condition of "All subtask are set to approved" is met. This way, until all items are approved, the transition will never happen.

 

I had to update my script runner version to get this working (3.0.16)

I'd really like to see exactly how this is done also

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

119 views 0 5
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