Forums

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

Sum Values of Custom Fields

Eric Lynch January 10, 2024

I am looking to sum the values of these 4 fields into the field outlined in the box. I am very new to Jira Automation and these seems incredibly simple so any help would be appreciated from the community. Thanks!

 

Aggregate Risk Screen Shot.png

2 answers

4 votes
Tim Kopperud
Community Champion
January 10, 2024

Hi @Eric Lynch, you might try something like this:

Use the Edit issue action within the automation rule.

Apply this smart value formula as the new value for the Aggregate Risk Score field (i.e. replace yellow marking in the image below).

{{#=}}{{issue.Likelihood Score}} + {{issue.Impact Score}} + {{issue.Ease of Detection Score}} + {{issue.Proximity Score}} {{/}}

image.png

More information about smart values functions

TimK

2 votes
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 10, 2024

Hi @Eric Lynch 

Adding to Tim's answer...

What are the types of your custom fields?

  • if they are numeric, they may be directly added as Tim described, or like this
{{issue.somefield.plus(issue.anotherfield)}}
  • if instead they are from a select list (i.e., specific values in dropdowns) the values must be added, such as with
{{#=}} {{issue.somefield.value}} + {{issue.anotherfield.value}} {{/}}

 

Next thing, to avoid problems I recommend confirming the smart values for those fields before trying to add them...

Smart values for fields are name, spacing, and case-sensitive.  And often the smart value does not match the displayed field name on the issue views.  The how-to article below helps to identify the correct smart value (and custom field id) for any supported fields for automation rules.

The essential steps are:

  • identify an issue which has your field(s)
  • call a REST API function with a browser to search for your issue:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • search on the page for your field, such as with CTRL-F
    • if you find the field, you will also find the smart value, custom field id, and structure / attributes it has
    • if you do not find the field, it is not supported by automation rules

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Finally, what do you want to happen if a value has not yet been set / selected for one of the fields?  Should it default to 0, prevent the sum calculation, etc.?

If you want the values to default to 0, that can be added with |0 as in this example:

{{#=}} {{issue.somefield|0}} + {{issue.anotherfield|0}} {{/}}

 

Kind regards,
Bill

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