Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Automation rule configuration related to sub-tasks and parent status

Federico Varchavsky
Contributor
March 8, 2023

Hello,

 

Quick summary:

I need to update the Parent US status when any update happens to any of its sub-tasks under these conditions:

 

1- All sub-tasks are in Done

except for one that should comply with

2- is the last sub-task (not in Done) and has a specific text in it's summary (let's say "last sub-task").

 

I need help setting up the conditions in the Automation Rule for this to happen only when all tasks are in Done except for the one whose summary is that specific text.

 

Thanks!

6 answers

1 accepted

2 votes
Answer accepted
Yvan Martin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2023

Hi there @Federico Varchavsky

Developer from Automation here.

You should be able to get this working with a variation of our rule template rule "When all sub-tasks are done → move parent to done"

In particular you'll need to slightly adjust the JQL to either look for status done or text contains last sub-task, you may also need to add a second related issues condition if you wanted to enforce that it must also have a sub-task with summary last sub-task.

Screenshot 2023-03-15 at 11.19.08 am.png
The above rule setup will check if either all sub-tasks or done or they contain the text last sub-task. As mentioned above if you also want to ensure they do have a sub-task with last sub-task as well you can add an additional related issue condition using "Some match"

Screenshot 2023-03-15 at 11.20.05 am.png

I hope this helps.


Federico Varchavsky
Contributor
March 15, 2023

Hi @Yvan Martin

 

Thank you for the response and the detailed info you provided me with.

 

I think this should be exactly what I'm looking for... I'll be trying it later today and let you know if any other issues arise in my automation quest. :)

 

Thanks for continuing to develop a great product like automation.

 

Have a great day!

Federico.

Trudy Claspill
Community Champion
March 15, 2023

Nice @Yvan Martin !

Much more elegant than my suggestion. I always forget about the JQL option in the Related Issues condition.

0 votes
Trudy Claspill
Community Champion
March 10, 2023

I have not worked out the details, but my thought is to use multiple Lookup Issue actions to look up groups of subtasks and compare the counts for the returned lists. Something like this:

1. Lookup all the subtasks of the issue. This tells you the total number of subtasks.

2. Lookup all the Done subtasks of the issue.

3. Lookup all the not-Done subtasks of the issue that also have the specified Summary text.

You will probably need to set variables to record the issue count results of each of the above lookups.

Next is some IF/Else nesting.

If #3 returns 1 and only 1 (not 0, not more than 1) result:

  • If totals #2 + #3 = #1, then you have achieved your desired target state. Update the parent issue.
  • Else you have not achieved the desired target state. There are other subtasks besides the "last subtask" that are not yet done. Don't update the parent issue.

Else either the last subtask is already marked as Done, or you have multiple subtasks with the specified Summary text. In either case, you don't want to update the parent issue, and you would exit the rule at this point.

Federico Varchavsky
Contributor
March 10, 2023

Hi @Trudy Claspill , thanks for your response.

 

How would I code in automation the functions to count the sub-tasks?

Both the total taks and the total tasks in Done status.

 

After this, it's be simple like this I think:

 

IF

(

total sub-tasks - total sub-tasks in Done = 1 // how would I code this in automation?

AND

remaining sub-taks summary ~ "Check out tests" // how would I select only the task that's NOT Done for this operaton

)

THEN

(

update parent task status as needed

:)

 

Thanks!

Trudy Claspill
Community Champion
March 10, 2023

How much experience do you have with Automation Rules? There is a lot of documentation available to assist you with constructing rules. The Automation feature within Jira also provides a library of some pre-built functions

Screen Shot 2023-03-10 at 10.57.37 AM.png

 

And there are more examples available online in the Automation Library sandbox. There is a link to that at the bottom of the Library tab.

Screen Shot 2023-03-10 at 10.58.44 AM.png

As I said, I have not worked out all the details, and I don't have time right now to do so. Here are some quick hints. 

To get a list of issues that match a set of criteria (a JQL filter) you can use the Lookup Issues Action.

After executing that action you can find out how many issues were found by referencing this smart value:

{{lookupIssues.size}}

 

You would need to construct the JQL filters that select the subtasks for each Lookup Issues action. You can reference the Search for Issues documentation  to learn more about constructing filters.

Use the Create Variable action to store the data from the above smart value. Subsequent Lookup Issue actions will overwrite the smart value.

There are IF and IF/ELSE condition blocks available when you are constructing rules.

There is an  Advanced Compare condition to allow you to compare smart values.

You may need to look at the math expressions documentation to figure out how to make the right statement for "A + B" in the advanced compare.

0 votes
Federico Varchavsky
Contributor
March 10, 2023

Hello,

 

How can I translate this condition into automation language?

All but one sub-tasks are Done AND this last sub-task has a summary containing "Check tests".

 

Thanks!

0 votes
Federico Varchavsky
Contributor
March 9, 2023

Hello,

 

Any advice or help on this would be much appreciated.

Thanks! :)

0 votes
Dan Breyen
Community Champion
March 8, 2023

There are two Automations in the library to deal with something very similar to this.  One is to mark all sub tasks Resolved when the main task is Resolved, and the other is to mark the main task Resolved when the SubTasks are Resolved.  You could probably tweak those to meet your needs.  I'm not a Automation expert, but it's something to look at.

0 votes
Jan Šimek
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.
March 8, 2023

HI @Federico Varchavsky 

so if I understand correctly your request, you are looking for automation which will change, when last of sub-tasks will not be in DONE resolution and has a specific text in Summary correct?

What should be the trigger point?

Thanks

Federico Varchavsky
Contributor
March 8, 2023

Yes!

 

It should be triggered when there's only one last taks NOT in Done status and the task has in its summary a specific text, e.g.: "Check out tests".

 

When these conditions are met the Parent User Story should be update to a specific status, e.g.: "Checking tests".

 

Hope this clarifies my inquiry.

Thanks!

Jan Šimek
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.
March 10, 2023

I am having issue telling to system by automation what is the "last sub-task"

Federico Varchavsky
Contributor
March 10, 2023

Hehehe... yeahp!

It's not that easy there to let the system know that all but one sub-task should comply.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events