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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,850
Community Members
 
Community Events
184
Community Groups

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

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 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?

@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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 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}}

@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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 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

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
AUG Leaders

Atlassian Community Events