JQL for Automation to move tickets based on sub-task's statuses

Daniel Ronnstam March 27, 2023

Hi. For our pipeline, we need to know how to set automation for a custom issue type, so that the automation;

1) Check the statuses of all the sub-tasks belonging to the parent issue.

2) Transition the parent issue to the same status as the sub-task that has the status FURTHEST TO THE LEFT (earliest) in the Workflow (or upwards in the workflow map).

As we need to have the parent issue in a status that reflects how far the least worked-on sub-task has come in the pipeline.

Does anyone know how to do this?

2 answers

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2023

Hello @Daniel Ronnstam 

What have you got so far for your automation for this?

Here is the start of a rule for one way you could accomplish this. I'm sure there are other ways, and I may think of a more elegant one later.

Screen Shot 2023-03-27 at 11.35.22 AM.png

 

The inelegant part of this is that you have to set of multiple IF/Conditions within the branch based on the available statuses, because you can't embed an IF/ELSE structure under a branch.. The first one checks if there are any sub-tasks in the left-most status of your workflow. If so, then set the parent status accordingly.

For the next set of conditions you have to check if there are any sub-tasks in the next status in the workflow AND confirm there are no sub-task in earlier statuses. You have to do this because without the ELSE structure the second set of conditions will be check even if the first set of conditions was matched.

Say you have a parent issue that has Sub-tasks that are in To Do and some Sub-tasks that are in In Progress. The first IF would find there are Sub-tasks in To Do and set the parent to To Do. The second set of conditions would initially find Sub-tasks in In Progress. If you didn't also check that there were no Sub-tasks in To Do, then the parent would be transitioned again to In Progress because some Sub-tasks are In Progress.

 

Brainstorming...

Another way to do this that would allow you to have an If/Else block would be to have one rule that is triggered by the Sub-task transitioning. In that rule only set a flag on the parent to note that a sub-task was transitioned.

Screen Shot 2023-03-27 at 11.44.36 AM.png

Then have a second rule that looks for a change in that Flag for the parent issue. Remove the flag, then use If/Else blocks to check for the statuses of Sub-tasks and set the parent issue status accordingly.

You would have to make sure that this rule had in the Details the box checked to "allow other rule actions to trigger this rule"

Screen Shot 2023-03-27 at 11.50.00 AM.png

Daniel Ronnstam March 28, 2023

I tried the first solution, and "almost" got it to work. The first rule works but not the second. I'm only trying with 3 statuses for now although I would need about 6 in the finished version. Is there something wrong with the "OR" logic? Will that not work?

automation.jpg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 28, 2023

What is the order of your statuses?

This step

Screen Shot 2023-03-28 at 1.50.51 PM.png

should include only the statuses that are earlier in the workflow than this step

Screen Shot 2023-03-28 at 1.51.43 PM.png

Daniel Ronnstam March 28, 2023

TO DO
WAITING
IN PROGRESS


Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2023

In that case you second IF statement should be looking for 

Some Sub-tasks match 

status = "WAITING"

AND No Sub-tasks match

status = "TO DO"

 

Then you would have a third IF statement like

Some Sub-tasks match

status = "IN PROGRESS"

AND No Sub-tasks match

status in ("TO DO", "WAITING")

Daniel Ronnstam March 30, 2023

Ok gotcha. I will try this. Actually, I have the following statuses in total. I noticed that it takes about 1 min before the parent ticket auto-moves. I guess that is because all the IF statements?

TO DO
WAITING
IN PROGRESS
UI REVIEW
CODE REVIEW
QA
TEST
UAT
DONE

Daniel Ronnstam March 30, 2023

Hi. I tried to set it for the 3 first statuses. I got the following:

bugs.jpg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 30, 2023

When saying a rule doesn't work, it is helpful if you provide the Audit Log details for the rule.

I went ahead and constructed the rule in my own environment to see how it would work. And I found it did not work. When there were no subtasks in the To Do status, the rule stopped executing at that first IF block.

I found that I had to separate the IF blocks into their own Branches, thus.

Screen Shot 2023-03-30 at 10.42.33 AM.png

Daniel Ronnstam March 31, 2023

Thanks!! I will try this out now!!

Daniel Ronnstam March 31, 2023

I almost got it working. It works for some steps in the full pipeline, but got the following log error. Are there some errors in the syntax?

 

ACTION DETAILS:

["10002"]

ISSUE CONDITION

The following issues passed:

VP-15

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues passed:

VP-5

RELATED ISSUES CONDITION

JQL search failed for some issues. This is most likely because the JQL with smart-values was not valid for this query:

"((parent = VP-5) AND (status = ("TO DO", "WAITING", "IN PROGRESS"))) AND (project in (10002))" - Operator '=' does not support the list value '("TO DO", "WAITING", "IN PROGRESS")' for field 'status'.

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues passed:

VP-5

RELATED ISSUES CONDITION

JQL search failed for some issues. This is most likely because the JQL with smart-values was not valid for this query:

"((parent = VP-5) AND (status = ("TO DO", "WAITING", "IN PROGRESS", "UI REVIEW"))) AND (project in (10002))" - Operator '=' does not support the list value '("TO DO", "WAITING", "IN PROGRESS", "UI REVIEW")' for field 'status'.

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues passed:

VP-5

RELATED ISSUES CONDITION

JQL search failed for some issues. This is most likely because the JQL with smart-values was not valid for this query:

"((parent = VP-5) AND (status = ("TO DO", "WAITING", "IN PROGRESS", "UI REVIEW", "CODE REVIEW"))) AND (project in (10002))" - Operator '=' does not support the list value '("TO DO", "WAITING", "IN PROGRESS", "UI REVIEW", "CODE REVIEW")' for field 'status'.

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

RELATED ISSUES CONDITION

The following issues did not match the condition:

VP-5

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 31, 2023

The error message tells you what the problem is.

JQL search failed for some issues. This is most likely because the JQL with smart-values was not valid for this query:

"((parent = VP-5) AND (status = ("TO DO", "WAITING", "IN PROGRESS"))) AND (project in (10002))" - Operator '=' does not support the list value '("TO DO", "WAITING", "IN PROGRESS")' for field 'status'.

You need to change the JQL to

status in (<comma separated list of values>)

Daniel Ronnstam April 4, 2023

Thanks!

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2023

If you have been able to successfully complete the automation rule and it is working as you desire, please consider marking the Answer as Accepted to help other users find posts with validated solutions.

Like Daniel Ronnstam likes this
Daniel Ronnstam April 5, 2023

Thanks it works!!!

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 5, 2023

Great! Glad I could help.

If your question has been answered please consider marking this Answer as Accepted to help other users find posts with validated solutions.

0 votes
Daniel Ronnstam March 27, 2023

Thanks!!! I will try out some of these ideas today or tomorrow and get back to you.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events