Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Automation: How to make Epic status change by percentage of completed stories of epic

Jonathan Chatfield
Contributor
May 7, 2024

Hello,

I have automated the process of story's status automatically changed at a certain percent of completed of sub-tasks status to Done. I am now looking at automatically updating the epic status progress from the completion of percentage of the automated story status with Done to change the Epic status to In Progress then after all the automated stories statuses are in  Done Status then put the Epic status to Done status as well. My To Do status category is Backlog. 
example.jpgThis is a project plan so we are going to have every task be a sub-task and those tasks live in Stories then every story is under a umbrella of a epic. Here is a example of that setup! 

I do not have the function LookupIssue and I have been told that I will need to do a process that uses REST API. I do not know much about this process but I am excited to hear from anyone out there! =D

2 answers

1 accepted

1 vote
Answer accepted
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.
May 7, 2024

Hi @Jonathan Chatfield 

You describe your automation rules do not have the Lookup Issues action; thus I am guessing you have Jira Server, correct?

If so...

First thing, please write some JQL which returns the child (and grandchild) issues for an epic, without returning the epic itself.

Then your rule could use the Send Web Request action to call the REST API issue search with that JQL.  Here is a how-to article for that technique and the issue search function documentation.

When you have the response, you could use math expressions and smart value, list filtering to get the percentage from the count "done" / total count.

Kind regards,
Bill

Jonathan Chatfield
Contributor
August 17, 2024

Hello @Bill Sheboy

 

We have finally gotten a new version of Jira and we have lookup action and variables. Can you show me a pathway of how to make epics automatically update based off the percentage of Story's status marked Done.

Like Bill Sheboy likes 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.
August 18, 2024

No problem; glad to help!  FYI...I am using Jira Cloud so please verify / test to confirm this works for your version of Jira.

The technique below uses the math expressions and list filtering I noted earlier.  Let's assume you want to update the percentage "Done" whenever the status of a child issue changes, and the percentage value will be stored in a custom field in the Epic.  Please adjust accordingly if those assumptions are incorrect.

  • trigger: issue transitioned
  • condition: issue type is Story, Task, Bug, or any of the types you have as children of your Epic
  • branch: to Epic parent
    • action: lookup issues, with JQL of: "Epic Link" = {{issue.key}}
    • action: update the parent's custom field with the result of this expression
{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.name,"Done"))}}+1{{/}}{{/}} ) / {{lookupIssues.size|0}} * 100, 0){{/}}

How that works...

  1. while iterating over the issues in the lookup result
  2. filter on the ones with a status of "Done", adding +1 for each of those
  3. and wrapping that in parentheses with a default value of 0 at the front
  4. divide that by the total count of issues in the lookup
  5. multiply by 100 and ROUND to the percentage is a whole number
  6. finally wrapping all of that in a math expression.

That percentage is by count.  If instead you want the percentage based on Story Points, try this one:

{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.name,"Done"))}}+{{Story points|0}}{{/}}{{/}} ) / {{lookupIssues.Story points.sum|0}} * 100, 0){{/}}

 

Jonathan Chatfield
Contributor
August 18, 2024

Thank you for responding back to me! I am currently working on this and I will try what you are writing. 

I do not want my team to be touching stories and above as we will only edit Sub-tasks. I have a automation that will automatically update stories from the percentage of Done statuses from Sub-Tasks. 
Will this automation still be triggered if I put story if it didn't get triggered by me but by a automation?

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.
August 18, 2024

By default, automation rules do not trigger due to actions from other rules.  This is to prevent errors / runaway looping.

When you intentionally want the actions of one rule to trigger another, in the downstream rule, go to the rule details and enable the option "Allow rule trigger..."  Then test thoroughly and monitor for any problems.

Jonathan Chatfield
Contributor
August 18, 2024

Yes! Thank you so much, it worked!! 

Like Bill Sheboy likes this
0 votes
Dave Rosenlund _Trundl_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2024

Hi, @Jonathan Chatfield. I'm not a developer myself, but I do have some getting-started tips for you:

 

Hope it helps,

-dave

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events