Forums

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

Custom field to hold a value from formula

Tanya August 7, 2024

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

 

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{{/}}
{{/}}

5 answers

1 vote
Christopher Yen
Community Champion
August 7, 2024

Hi @Tanya 

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

0 votes
Tanya August 8, 2024

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

 

Screenshot 2024-08-08 at 9.34.10 AM.png

0 votes
Paul Pasler
Atlassian Partner
August 8, 2024

Hi @Tanya ,

as a member of the app development team, I recommend exploring our Awesome Custom Field app, which includes the Advanced Formula field. 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

 

 

0 votes
Adolfo Casari
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.
August 7, 2024

@TanyaShould 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.

Tanya August 8, 2024

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

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{{/}}
{{/}}

Adolfo Casari
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.
August 9, 2024

@TanyaBased 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.

 

0 votes
Christopher Yen
Community Champion
August 7, 2024

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 

Suggest an answer

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

Atlassian Community Events