Forums

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

How to create an automation rule that updates an Epic's custom field with its completion percentage?

Fernando Martinez April 21, 2023 edited

I am trying to build an automation rule that meets the following requirements:

  1. Executes weekly.
  2. Selects target Epics via JQL.
  3. For each of the Epics selected, the percentage completion of the Epic is computed. Completion of each child issue is defined as the issue being resolved.
  4. For each of the Epics selected, the computed percentage completion is set into an existing field in the Epic.

I am not sure how to implement step (3). I was hoping to put the percentage completion into a smart value for each Epic, and then use that value in step (4).

1 answer

1 accepted

3 votes
Answer accepted
Trudy Claspill
Community Champion
April 21, 2023

Hello @Fernando Martinez 

Welcome to the community!

Generally Epics don't have Sub-tasks linked directly to them. Instead they have child Issues. Do you really need to look at subtasks or are you trying to look at child issues?

Screen Shot 2023-04-21 at 12.59.03 PM.png

 

Can you show us the rule you have constructed so far? Are you selecting your Epics with a JQL that is part of the Schedule trigger?

Fernando Martinez April 21, 2023

@Trudy ClaspillThanks for the warm welcome!

> Do you really need to look at subtasks or are you trying to look at child issues?

Ah, yes, I meant child issues.

> Are you selecting your Epics with a JQL that is part of the Schedule trigger?

Right now I am using a manual trigger during the proof of concept phase, but yes I intend to use the same JQL in the Schedule trigger. I have a "Then: Lookup issues" step with the JQL that selects the target Epics. I confirmed that the list is correct by printing `{{lookupIssues}}` to the audit log.

Trudy Claspill
Community Champion
April 21, 2023

You can set up a rule with a Schedule trigger and still run it on demand using the Run Now button. You don't have to create a Manual trigger rule for testing.

Screen Shot 2023-04-21 at 1.11.43 PM.png

 

For testing, in your trigger you could set the JQL to select just one Epic. Make sure to uncheck the box below the JQL field.

Screen Shot 2023-04-21 at 1.13.39 PM.png

For the next step you would then use a Lookup Issue action to get a list of all child issues of the Epic, regardless of status. Use "Epic Link" if the child issues are in Company Managed projects. Use "Parent" if the child issues are in Team Managed projects.

Screen Shot 2023-04-21 at 1.16.55 PM.png

 

Record the number of issues returned in a variable.

Screen Shot 2023-04-21 at 1.18.31 PM.png

Then do another lookup to find just the Done issues and record that count in another variable.

Screen Shot 2023-04-21 at 1.20.35 PM.png

 

If the total child issues done is not 0

Screen Shot 2023-04-21 at 1.22.11 PM.png

 

Create another variable to save the Done/Total value

Screen Shot 2023-04-21 at 1.35.22 PM.png

{{#=}} {{TotalChildIssuesDone.asNumber}} / {{TotalChildIssues.asNumber}} {{/}}

Then you can express that as a Percentage using

{{DoneCalc.asNumber.asPercentage}}

Fernando Martinez April 21, 2023 edited

@Trudy ClaspillThanks, this is making a lot of sense! I have a follow up question.

> For the next step you would then use a Lookup Issue action to get a list of all child issues of the Epic

I would need to perform this and the subsequent steps for each Epic in the initial Issue Lookup action since I wouldn't be working with just one Epic in production.

Which automation constructs would allow me to repeat these steps for each Epic in the initial Issue Lookup step?

Trudy Claspill
Community Champion
April 21, 2023

When you include in the Schedule trigger a JQL statement to select issues, all the actions in the rule will then be performed against each issue returned by that JQL statement.

If you include the JQL to select Epics in the trigger then you don't need a subsequent Lookup step to retrieve the Epics.

Like • Fernando Martinez likes this
Fernando Martinez April 21, 2023

Thanks! This worked perfectly. I accepted your answer, so feel free to edit the top level comment with the complete resolution if you have time.

Like • Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events