Summing up the numeric field values in tasks to display in the epic, getting 0 (zero) as resault

Taha Tabatabaei March 5, 2024

Hi,

I'm trying to use the method shown in the image below with the help of "Automation for Jira" to sum up the values of a numeric custom field (for example customfield_11035) in tasks and display the total in their respective epics (parent). the automation executes correctly, but it consistently returns 0 (zero) as the result within my epics.

 

Do you have any suggestions on how to fix this issue?

 

1.

Capture.JPG

2. Audit log 

Capture1.JPG

 

If you have a better method for doing this task, I would be happy if you could suggest it to me.

Thank you.

3 answers

1 vote
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.
March 5, 2024

Hi @Taha Tabatabaei 

You are using Jira Data Center, and not Jira Cloud, correct?

If so, the Lookup Issues action for your automation version only contains a few issue fields, and it does not contain most custom fields.  Here is the suggestion to improve that: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

When the Lookup Issues action was added for Jira Cloud, it also only supported about a dozen fields.  About a year later all of the remaining ones were added, so perhaps the same will happen for Jira Server / Data Center also.

 

For some work-arounds, use:

  1. the bulk-issue handling feature of scheduled triggers or branches, or
  2. the Send Web Request action to call the REST API with JQL for an issue search

For your scenario, you will need the second one as you need to branch to the epic to perform the edit.  Please see this how-to article to learn about that technique: 

https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

Kind regards,
Bill

Taha Tabatabaei March 6, 2024

Hi Bill,

Thank you for your attention and guidance.

Regarding the limitation of the lookup issue in automation that you mentioned, I think it may not be the cause of the problem in my case. The lookup action appears to be executed correctly, as indicated in the second picture I uploaded. The audit log confirms its success in finding the relevant child issues.

However, the issue arises in the subsequent step when the field edit action should be performed. Unfortunately, it fails to calculate correctly, consistently resulting in 0. As a test, I manually set the field value in the Epic (parent) to 40 and after triggering the automation with a new value in the tasks under that Epic, the value reverts from 40 to 0 again.

This leads me to suspect that there might be a problem in the final stage of the automation process. I would greatly appreciate any suggestions or guidance you may have.

Thank you.

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.
March 6, 2024

When a smart value does not exist, a rule often does not fail.  Instead a value of null is substituted in its place.  Only in cases where a null value would lead to an error does the rule fail.  (Aside: this is one good reason to confirm the correct smart values are used, as a typo will not necessarily cause a rule error in the audit log.)

 

You can confirm those fields are likely empty by writing this to the audit log after your lookup issues action:

Looked up issues: {{#lookupIssues}}{{key}}: {{customfield_10305}}; {{/}}

This will iterate over the lookup results, writing the key and your custom field.  I expect none of the custom field values will be included.

 

Like Taha Tabatabaei likes this
Taha Tabatabaei March 9, 2024

Thanks Bill,

I understand your explanation. I've tried your method to confirm the field in the audit log, and it returns null. I'm uncertain why Jira doesn't support these fields for lookup actions, given their widespread use. Thank you for your guidance and your time. King Regards

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.
March 9, 2024

Thank for that information as it confirms my earlier hypothesis: the fields are not yet supported by the lookup issues action for Jira Data Center.

Please see the work-arounds I suggested earlier for alternatives.

Like Taha Tabatabaei likes this
0 votes
Marc - Devoteam
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.
March 5, 2024

Hi @Taha Tabatabaei 

Check In the JSON update the {{lookupIssues.customfield_10305.sum }} to {{lookupIssues.<name of the field>.sum}}

Taha Tabatabaei March 5, 2024

Hi marc,

Thank you for your consideration.
I've tried the method you suggested' but unfortunately the resault on the epic is still zero.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 5, 2024

Hi Taha,

This is one I use that works. You should be able to simply edit the field - and use sum instead of average like in my example. 

Also, I would change over to Parent instead of Epic Link since that has been deprecated. 

Screenshot.png

Taha Tabatabaei March 5, 2024

Hi John,

Thank you for your consideration. I've tried the method you suggested' but unfortunately the resault on the epic is still zero.

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 5, 2024

Well, I know mine works, so there is something in yours not right. haha. I suggest logging out the values for the fields before you do the summation to see what the values of the fields are. 

Like # people like this

Suggest an answer

Log in or Sign up to answer