Custom field to hold a value from formula
Asked by Tanya:

I have 2 custom (global) fields "Impact group" and "High level estimate" which are dropdowns. Each option in the dropdown I want to associate with a number. Then I want to add those 2 numbers and show the result in another custom field "Calculated priority" (number).

My fields:

**"Impact group" (dropdown):**   
Internal stakeholders - should be worth 5 points  
Compliance and legal - should be worth 4 points

**"High level estimate" (dropdown):**   
Low: should be worth 1 point  
Medium: should be worth 2 points

Now, for example, if I select:  
"Internal stakeholders" AND "Low" -\> my calculated priority should show 6  
"Internal stakeholders" AND "Medium" -\> the result should be 7  
"Compliance and legal" AND "Low" -\> 5  
Etc.

I don't want to use ScriptRunner. I am using Automation and creating a Rule for "Value Changed". You can see where I am entering the formula:

![Screenshot 2024-08-07 at 7.22.56?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340629iC11A81733E4980B2/image-size/large?v=v2&px=999 "Screenshot 2024-08-07 at 7.22.56?PM.png")

My formula is not working. Any idea why?

```
{{#=}}
0 + 
{{#if(equals(issue.fields.Impact group.value, "Internal stakeholders"))}}5{{/}}
+ {{#if(equals(issue.fields.Impact group.value, "Compliance and legal"))}}4{{/}}
+ {{#if(equals(issue.fields.High level estimate.value, "Low"))}}1{{/}}
+ {{#if(equals(issue.fields.High level estimate.value, "Medium"))}}2{{/}}
{{/}} 
```


Answers:
author: Christopher Yen
body: Hi [@Tanya](/t5/user/viewprofilepage/user-id/5344109)

Will the values grow much going into the future? if not I think it might be easier to create and maintain this functionality using the IF or ELSE: Add condition options

This is how we create our incident priority matrix calculation

![2024-08-07 18_38_25-Rule builder - Automation - Service Desk - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/340640i2AB11DCE7314FC3B/image-size/large?v=v2&px=999 "2024-08-07 18_38_25-Rule builder - Automation - Service Desk - Jira.png")


author: Tanya
body: I am getting these errors in audit log - whether or not I try ids or field names. What doe sit mean? Also as you can see in the attached video, "Computed priority" stops working after I make a few selections:

[https://www.dropbox.com/scl/fi/8yk4azzeomyqv37vl1z5q/stuck.mov?rlkey=wbvel5c1bnb6pj55ejs2e0i2a\&dl=0](https://www.dropbox.com/scl/fi/8yk4azzeomyqv37vl1z5q/stuck.mov?rlkey=wbvel5c1bnb6pj55ejs2e0i2a&dl=0)

![Screenshot 2024-08-08 at 9.34.10?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340773i2DDC7A1353CD9AE6/image-size/large?v=v2&px=999 "Screenshot 2024-08-08 at 9.34.10?AM.png")


author: Paul Pasler
body: Hi [@Tanya](/t5/user/viewprofilepage/user-id/5344109) ,

as a member of the app development team, I recommend exploring our [Awesome Custom Field app](https://marketplace.atlassian.com/apps/1228720/awesome-custom-fields-advanced-custom-field-types-for-jira?hosting=cloud&tab=overview&utm_source=community&utm_medium=answer&utm_campaign=advanced-formula), which includes the [Advanced Formula field](https://awesomecustomfields.wikipage.io/c/77037570/advanced+formula). This feature allows you to perform the necessary calculations effortlessly with Jira expressions, without the need for automation.

In case you have feedback, please get in touch!

Cheers,  
paul


author: Adolfo Casari
body: [@Tanya](/t5/user/viewprofilepage/user-id/5344109)Should be

```
issue.High level estimate.value OR High level estimate.value
```

However in a formular It's better to use the customfield id instead of the name should you change its name later.

comments: author: Tanya
body: I tried it and I always get this - it changed numbers as needed, and then it gets stuck and doesn't do anything. The delay also is very long. Why?

See in this video I set fields to "Compliance and Legal" AND "High" = 7. Ok. Then I change to "Low" - nothing changes.

[https://www.dropbox.com/scl/fi/8yk4azzeomyqv37vl1z5q/stuck.mov?rlkey=wbvel5c1bnb6pj55ejs2e0i2a\&dl=0](https://www.dropbox.com/scl/fi/8yk4azzeomyqv37vl1z5q/stuck.mov?rlkey=wbvel5c1bnb6pj55ejs2e0i2a&dl=0)

Again my formula was this below, and I get the same result with ids:

{{#=}}  
0  
+ {{#if(equals(issue.Impact group.value, "Internal stakeholders"))}}5{{/}}  
+ {{#if(equals(issue.Impact group.value, "Compliance and legal"))}}4{{/}}  
+ {{#if(equals(issue.fields.Impact group.value, "Customers"))}}3{{/}}  
+ {{#if(equals(issue.fields.Impact group.value, "Partners and vendors"))}}2{{/}}  
+ {{#if(equals(issue.fields.Impact group.value, "Development team"))}}1{{/}}  
+ {{#if(equals(issue.High level estimate.value, "Low"))}}1{{/}}  
+ {{#if(equals(issue.High level estimate.value, "Medium"))}}2{{/}}  
+ {{#if(equals(issue.High level estimate.value, "High"))}}3{{/}}  
{{/}}


author: Adolfo Casari
body: [@Tanya](/t5/user/viewprofilepage/user-id/5344109)Based on the error from the log, problem seems to be "+" being outside the condition.

Should be 0+4+1 , not 0 + + 4 + + + + 1 + +

Put it inside.


author: Christopher Yen
body: Regarding your formula possibly changing to using the custom field ID's might

workissue.fields.customfield_XXXXX

[How to find any custom field's IDs](https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html)


Tags: cloud

jira-service-management

jira-service-management-cloud