Forums

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

Automation for updating the numerical Value of a field based on child issue condition.

Drew McLean January 2, 2024

Hi,

This may not be a functionality that is possible but I want to check with others. 

I have a numerical field on a Parent Epic that is used to keep track of the number of stories in the 'To Do' status category.

I want to create an automation that, on manual trigger, will check the status category of the stories, and if it falls into the 'To Do' status category to increase the value of the field on the Parent Epic.

So 6 stories in 'To Do' results in Parent Epic field = 6.

I know I can do this in code but not sure if this is possible in Jira Automation.

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
January 2, 2024

Hello @Drew McLean 

Yes, this is possible with an Automation rule. Here is the rule:

1. Trigger: Manual

2. Use a Condition to confirm the rule was triggered on an Epic.

3. Use a Lookup Issue action to look for all child issues of that Epic where the child issue is a standard level issue type and its current status is within the "To Do" status category.

4. Edit the Epic to set your field to the count of issues found by the Lookup Issue action, or to zero if the action did not find any issues. (I used the Summary field but you would set your custom field.

Screenshot 2024-01-02 at 9.09.50 AM.png

Information about each of these functions can be found in the documentation.

https://support.atlassian.com/cloud-automation/docs/jira-cloud-automation/

Drew McLean January 2, 2024

@Trudy Claspill Thank you for this! I saw the lookup Issues action but was never really sure on how to implement it in this case. I tried this and it worked exactly as expected. 

Thank you!

Drew McLean January 2, 2024

@Trudy Claspill one last question. 


Say I want to repeat this action for more than one field. Can I reuse this in the same automation or do I have to create a separate rule for each?

Drew McLean January 2, 2024

Nevermind. Figured it out myself. Thanks again!

Trudy Claspill
Community Champion
January 2, 2024

You can update multiple fields with the one result or have multiple Lookup Issues actions to update different fields.

Note that each Lookup Issues action overwrites the results of the previous use of the action. So you need to execute the Lookup Issues actions, then use the result before executing another Lookup Issues actions.

Like Drew McLean 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.
January 8, 2024

Hi @Drew McLean 

Adding to Trudy's answer...

For your scenario of wanting to count various things in the child issues, based on some criteria, it may be possible to do this with one single lookup issues call, smart value list filtering, and math functions.  The advantage of this approach is it may be faster than calling lookup several times.

Here is the how-to on smart value, list filtering and a reference to math expressions if you want to try this: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588 and https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

With this you can use a math expression instead of the size of the resulting lookup.  Perhaps like this for the issue count with a status category of "To Do":

{{#=}}0{{#lookupIssues}}{{#if(status.statusCategory.name.equals("In Progress"))}}+1{{/}}{{/}}{{/}}

How this works:

  • iterate over the results of the lookup issues
  • filtering the status value's category to only include "In Progress"
  • and when found, add one with +1
  • wrapping all of that in a math expression, with a default value of 0 at the front

The same technique works to sum / count / average anything.  (Although average takes a bit more work.)

Kind regards,
Bill

Like Drew McLean likes this

Suggest an answer

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

Atlassian Community Events