Forums

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

SmartValue to update story points and issue counts when child issues are added or deleted

CC
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.
July 10, 2023

Leveraging this discussion, Solved: Smart Value to display the sum of child issues lin... (atlassian.com),  I created two custom fields that calculate the total number of story points and the total number of issues per epic via the attached automaton.  The next step is to have the automation trigger whenever a child issue is added or deleted.  At the moment it only updates if a child issue is added and not when a child issue is removed.

Additionally, I'm looking for a way to update existing epics in bulk without breaking the system.

PS Company managed and in the cloud.

@Trudy Claspill image.png

3 answers

2 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
July 10, 2023

Hello @CC 

You will need a separate rule to catch when an issue is removed from an Epic.

This rule includes Log actions with the Smart Values that give you the New and Original value for the Epic Link when it has been changed.

Screen Shot 2023-07-10 at 4.44.53 PM.png

What you care about is when the {{fromString}} value is not EMPTY. That means the issue was associated with an Epic before, but is now associated with a different Epic or no Epic at all.

Screen Shot 2023-07-10 at 4.49.20 PM.png

You then need to branch to the former parent Epic, look up its current children, and use the sum function to reset the values in the Epic.

Screen Shot 2023-07-10 at 5.01.49 PM.png

Make sure to use an OR option to set the field to zero in case the Lookup Issues action returns no issues.

Screen Shot 2023-07-10 at 5.03.03 PM.png

Trudy Claspill
Community Champion
July 11, 2023

We didn't address your question about updating existing Epics, without making changes to the child stories.

For that I would recommend that you create a Schedule trigger. In the Trigger include a JQL for selecting the Epic issues. Then add the Lookup Issues step and Edit Issues steps. You don't need any branches because the steps will be executed for each issue returned by the JQL in the trigger.

Screen Shot 2023-07-11 at 8.12.03 AM.png

Screen Shot 2023-07-11 at 8.13.33 AM.pngScreen Shot 2023-07-11 at 8.13.59 AM.png

It doesn't matter what schedule you set on the trigger. After publishing the issue you can select the Run Now button to run it immediately, and then disable the rule so it doesn't actually run on a schedule.

Screen Shot 2023-07-11 at 8.14.10 AM.png

Like Bill Sheboy likes this
0 votes
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.
July 10, 2023

Hi @CC 

There are several scenarios to handle:

  1. issue added to an Epic, and so update that Epic
  2. issue removed from an Epic, and so update that Epic
  3. issue removed from one Epic and added to another, and so update both Epics
  4. issue created and assigned to an Epic, and so update that Epic

For the last of these please use the Issue Created trigger.  For the others please use the Issue Updated trigger, and add conditional logic to check the changelog for changes to the Epic Link field.  Please look here to learn more about that smart value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog--

Kind regards,
Bill

0 votes
CC
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.
July 11, 2023

@Bill Sheboy @Trudy Claspill   Thank you both so much.  Give me a few days to put it on in motion.  Thank you again.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events