[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

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)

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

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

268 views 0 6
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