Forums

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

Trigger tasks whenever a subtask's status is changed

Martina
Contributor
February 13, 2024

Hey all, I was wondering if you know what's the most automation-efficient to trigger tasks whenever a subtask’s status is changed.

I have a short amount of automations allowed, this is why I am asking.

I have been doing that the trigger was:

“When ANY task is transitioned to Done” and condition IF task = subtask AND summary = “Summary Description”.

But this might not be the most efficient way since tasks will be moved to done a lot, and I don't want the rule to be run every time, otherwise I'll loose automations.

Every time a subtask is created it already has a unique # / ID. Maybe I can reference that unique field instead of creating a second number for it? But I don't know exactly how this is done.

P.S. it will also need to work for tasks that are no longer subtasks but LINKED tasks - which will happen because I would like to move subtasks into different projects.

Thank you so much in advance!

 

3 answers

1 accepted

0 votes
Answer accepted
Martina
Contributor
February 14, 2024

Hey @Bill Sheboy @Walter Buggenhout I wonder what you think about this if you have the time:

So just to reiterate, I'm building a rule that changes the status of a subtask whenever the status of another subtask changes. Here's the code, but the problem is that there will be multiple subtasks matching the issue summary, since there will be one per task, so I wonder whether you have ideas on how to check whether these 2 subtasks belong to the same parent or task. 

Thanks!image.png

Bill Sheboy
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.
February 14, 2024 edited

First, if this rule should only process for subtasks, please add a condition after the trigger (or add to your JQL condition) for issuetype = subtask.

Next, do you want to find the one which has the same parent issue?  If so, please add that to the JQL for your branch.

 

Martina
Contributor
February 14, 2024

yes! I want to fint the one with the same parent issue, but how do I do it? I thought something like issue.parent.key = triggerIssue.parent.key but it doesn't work.

thanks for getting back @Bill Sheboy 

Bill Sheboy
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.
February 14, 2024

For the branch, please try adding this:

AND parent = {{triggerIssue.parent}}

 

Like Martina likes this
Martina
Contributor
February 14, 2024

@Bill Sheboy it doesn't work unfortunately, it says: 

The issue key 'TRIGGERISSUE.PARENT' for field 'parent' is invalid.

Martina
Contributor
February 14, 2024

@Bill Sheboy BTW, I was able to fix it, thank you so much!

Attaching the code in case you're interestedScreenshot 2024-02-15 at 00.31.10.png Screenshot 2024-02-15 at 00.31.24.png

Like 2 people like this
Bill Sheboy
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.
February 15, 2024

I am glad you got something to work!

Although it is curious adding that expression to the JQL branch did not work, showing "field 'parent' is invalid."  It would have been valuable to see both the actual branch and the audit log for that case, as I tested it before I posted the suggestion.

0 votes
Martina
Contributor
February 14, 2024

Thanks to both! I'll try to refine it!

0 votes
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2024

Hi @Martina,

A rule is only counted towards the execution limit when it performs an action. So, just triggering it does not necessarily count towards the limit.

Having said that, that does not mean you should get careless of course. It will be important to define more precisely what you want to automate ...

In general, if you start with an issue transitioned trigger, that is just the first step. You can further refine with conditions until you get exactly what your need:

  • Adding the appropriate target status (done) in your trigger will be a first refinement;
  • An issue fields condition on issuetype = subtask is a second possible refinement
  • You might be able to restrict the automation to a limited set of projects
  • ...

until it only fires in that limited number of cases where you really need it to.

I think the very first thing you need to do is go to the drawing board and be very specific about the logic.

One more thing about the following quote:

Every time a subtask is created it already has a unique # / ID. Maybe I can reference that unique field instead of creating a second number for it? But I don't know exactly how this is done.

That does not really make sense if I read it. You don't create numbers - you create issues in Jira. And indeed, there is absolutely no need to create an issue if it is already there. It would make more sense to do something else with that existing issue: update a field, change it's status, ... whatever it is that you want to do. But still: whether your automation rules create an issue or updates an existing one doesn't make a difference against the amount of executions.

So once more, try to be specific about what it is you want to automate; define it in common language and only then try to find the best way to implement it in Jira.

Hope this helps!

Bill Sheboy
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.
February 13, 2024

Hi @Martina 

Adding to Walter's answer...

There are specific rule actions which count toward automation usage, not all actions.  Please review this article to learn what counts, and perhaps how the limits spanning all of your Atlassian products can be utilized to mitigate the packaging changes.

https://www.atlassian.com/blog/announcements/cloud-automation-packaging-update

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer