Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I have a Story automatically update when all of its linked Tasks are DONE?

Much like the automation rule where an Epic will automatically update when all of it's Stories are updated to DONE, I want to do the same with Stories and their linked Tasks.

2 answers

0 votes
Curt Holley Community Leader Dec 20, 2021

Hi @Rich Evers 

Welcome to the community.

 

You might wanna get more conditional (I know I would), but the basic version of the automation would be something like:

auto.png

Not sure how I would need to get more conditional, but I did exactly the above and it didn't work.  

Hi @Rich Evers -- Welcome to the Atlassian Community!

To confirm your use case, which do you mean:

  1. when all of the sub-tasks of a story complete, do <X>
  2. when all of the linked issues (of any type) of a story complete, do <X>
  3. something else?

Case #1 can be done in one automation rule, triggered on the sub-task changing.  There may be an example in the template library like this.

Case #2 probably can be done in one rule, triggered on a schedule (for the story) or from the linked issue, probably using branches, lookup issues, and created variables.  It definitely and safely can be done in two rules, with the original linked issue triggering another rule to get the story to check its linked issues.

Kind regards,
Bill

Curt Holley Community Leader Dec 20, 2021

Good point @Bill Sheboy  

My example is all about linked issues @Rich Evers but either/both can be done.

Other complexities may arise from different workflows and or different "Done" status categories within...resolution codes (if required) etc. But all very doable.

let us know ow you get on.

Case #2.  When all of the linked Tasks of a Story are updated to DONE, automatically update Story to Done.  I've tried retrofitting the rule that Jira has pre-defined for the parent-child relationship with Epics and Stories, replacing "parents" and "childs" with "linked" but for whatever reason is not working out.

Curt Holley Community Leader Dec 20, 2021

For Case#2. Can you show us the rule and any info in the audit logs?

Curt Holley Community Leader Dec 20, 2021

The "For stories (or other issues in Epic)" branch only works if the trigger issue is an Epic.

Try a linked issues branch

Like Bill Sheboy likes this

No good.  Thanks, though.

Rich, based on your rule and Curt's ideas, does your rule now look like this?  Note I made a substitution in the JQL to check statusCategory instead of status.

Please note: given the possible slowness of this rule, I still think it might cause a run-away, looping condition.  Perhaps the 2-rule approach will cause the hard-stop to prevent this, but it would require some assumptions you have not stated, such as the number and type of linked issues.

Capture.PNG

Like Curt Holley likes this

I don't have the options to build it that way.  It will only let me do Types: All link types and that is it.  From there it is only allowing me to chose a condition.  See below: Screen Shot 2021-12-20 at 8.39.22 PM.png

Please try changing the Condition to "all match specified JQL" to see that option.

If I do that, then I need to manually enter in a field here...Screen Shot 2021-12-24 at 2.45.43 PM.png

I've tried putting in various things here and it has errored out.  

What have you tried putting in the "matching JQL" field?  What is happening when it errors out?

Please try:

statusCategory = Done

I did what suggested above, and it didn't work.  It did not give me an error message, though.  Thanks for the attempt, though!

Hi, Rich. 

Just to confirm, would you please post images of your current rule and an audit log details from an attempted execution?  That may reveal something I am not seeing from trying to help, one rule component at a time.  Thanks!

Screen Shot 2021-12-29 at 2.46.26 PM.pngScreen Shot 2021-12-29 at 2.56.19 PM.pngI can't seem to figure out what project restriction may be prohibiting the results I'm seeking.

Thanks for those images.  Okay...

  • TESTRICH-33 transitioned to Done, and
  • it is linked to TESTRICH-30...so that one was processed in the branch, and
  • TESTRICH-30 did not meet a condition

What is the current status of TESTRICH-30? 

  1. If it is not Done, the first condition was not matched
  2. If it is Done, it is the second condition which needs investigation.

30 did not update to done.  The link "how" I guess, are all labeled as "relates to."  I guess another question, is that why can't we have a parent-child relationship with stories and epics, like we do epics and stories?  That is ultimately what I'm trying to do.  Am I going about this the correct way?

For epics and stories/tasks/bugs, the relationships are easier:

  • when going from epic to children, use the built-in branch option
  • when going from children to epic, use a JQL branch with "epic link" = {{triggerIssue.epic link}}

My understanding was you were evaluating any links, and not just epic/children.  Was I incorrect?

Correct, I think.  All I want to see happen is that when all the tasks are updated to DONE that are assigned to a specific story, the said story will update to DONE as well.

The hard part is that I'm not a tech-y software guy, so all of this language and how the software works is very foreign.  I just want to it work and do things that I want it to do.  :)

Let's confirm how you use issues In Jira as that will confirm we are talking about the same thing.  In Jira, you can relate issues with a hierarchy and/or linked issues:

Hierarchy of issues

  • Epics
    • Stories
      • Subtasks

Linked issues

  • Any issue (Epic, Story, Task, Subtask, Bug), linked to another issue

 

Which of these matches what you are doing: hierarchy or linked?

  • epics
    • stories
      • tasks

Trying to link tasks to stories because there is no ability to create a parent-child relationship between the two.  Epics and stories have the parent-child relationship already pre-built in the software.

Thanks! 

Next, can any single Task be linked to multiple Stories? (Note there is no restriction to this in Jira so this would just be manually enforced.)

If so, what you describe cannot be done with automation rules.  The act of checking from Task --> Story --> Task --> Story... could create a loop.

Negative.  A task belongs to a single dedicated story.

Okay, then let's try this one for Task to Story to Tasks, using lookup issues to check the counts, step by step

  • trigger: issue transitioned to Done
  • condition: issue type is Task
  • action: lookup issues to get the one-and-only-one Story (if any exist)
    • JQL: issue IN linkedIssues( {{triggerIssue.key}} )
  • advanced compare condition: {{lookupIssues.size|0}} equals 1
  • advanced compare condition: {{lookupIssues.first.issueType}} equals Story
  • action: create variable for varStoryKey set to {{lookupIssues.first.key}}
  • action: lookup issues to get any issues linked to the story which are not done
    • JQL: issue IN linkedIssues( {{varStoryKey}} ) AND statusCategory != Done
  • advanced compare condition: {{lookupIssues.size|0}} equals 0
  • branch: on JQL to the story with key = {{varStoryKey}}
    • action: transition the story issue, copying from trigger issue (Done)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

173 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you