[JIRA] Autotransition Subtasks on Parent Transition?

Leonard Marin April 17, 2013

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

0 votes
Answer accepted
Nadir MEZIANI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2013

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)

Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2013
Leonard Marin April 17, 2013

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

0 votes
Labatt April 20, 2013

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.

0 votes
Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2013

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events