[JIRA] Autotransition Subtasks on Parent Transition?

I'm trying to create a (k) SIL Post-function using JJupin to allow me to autotransition all subtasks in a status called "On Hold" when it's parent issue goes to a status of the workflow called "On Hold" through a transition called "Set On Hold".

The problem is that the Parent issue has a workflow which differs from those the subtasks have.

So:

Parent Issue -> Workflow 1

Subtask type 1 - > Workflow 2

Subtask type 2 -> Workflow 2 (the same as type 1)

Subtask type 3 -> Workflow 3

Parent status = "On Hold", ID: 9

Parent transition = "Set On Hold", ID: 241

Subtask type 1 status = "On Hold", ID: 17

Subtask type 1 transition = "Set On Hold", ID: 511

Subtask type 2 status = "On Hold", ID: 17

Subtask type 2 transition = "Set On Hold", ID: 511

Subtask type 3 status = "On Hold", ID: 18

Subtask type 3 transition = "Set On Hold", ID: 561

I'm using this code but it does nothing:

//autotransitioning subtasks in `On Hold`
//when parent task is trasitioned in `On Hold`

string sub;

for (sub in subtasks(key)) {

//if found subtask that has not been transfered to `On Hold`
if (%sub%.status!="On Hold") {
//then execute the transition to `In Progress` state
autotransition("Set On Hold", sub);
}
}

Could someone please help me with the code?

3 answers

1 accepted

This widget could not be displayed.

Routine autotransition cant execute like this


autotransition(transitionid, issueKey)

In this case, it's like this

Subtask type 1
autotransition(511, sub)


Subtask type
autotransition(511, sub)


Subtask type 1
autotransition(561, sub)

works! but no validators or conditions should be on the transition of the subtasks (511, 561)

This widget could not be displayed.

It should work both ways. Are there any exceptions in the logs?

Try using autotransition("Set On Hold", sub, true);

This widget could not be displayed.

By the way - I would recommend using the name of the transition as opposed to the ID. For example.. we work in an environment where we have a dev Jira server and a production Jira server. The transitions are named the same on both boxes, but they aren't necessarily numbered the same. This allows portability.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

428 views 3 17
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