Forums

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

Automation rule to calculate current and target score

Khalid El-Bialy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2025

I am looking to enable simple equation which is being done easily in Excel :

 

  • Current Score = (Weight % × Current Maturity Level number) / 5
  • Target Score = (Weight % × Target Maturity Level number) / 5

i have around 14 blocks/epics that have the , current set up , 

  1. current and target maturity levels field as a dropdown list with five options "L1,L2,L3,L4,L5".
  2. Weight %: number field that has a specific number that indicate the weight of each epic example "11% per epic number 1 
  3. current and target score filed : that is also numbers.

so if we consider i am selecting drop down in current maturity level as : L2 the equation should be calculate as example ( 11*2/5 = 4.4) and 4.4 should automatically reflect in the current score field.

so if we consider i am selecting drop down in target maturity level as : L3 the equation should be calculate as example ( 11*3/5 = 6.6) and 6.6 should automatically reflect in the target score field.

I have tried many automation rule, none has works as i am facing  challenging converting the text field to number so the math would work, anyone can help ?

Last equations i have used and returned with error cannot convert to number :

 

 

    • set the "Current Score" field:
      {{issue."Weight %".toNumber.default(0)}} * {{if(issue."Current Maturity Level".value.equals("L1"), 1, if(issue."Current Maturity Level".value.equals("L2"), 2, if(issue."Current Maturity Level".value.equals("L3"), 3, if(issue."Current Maturity Level".value.equals("L4"), 4, if(issue."Current Maturity Level".value.equals("L5"), 5, 0)))))}} / 5
    • Set the "Target Score" field:
      {{issue."Weight %".toNumber.default(0)}} * {{if(issue."Target Maturity Level".value.equals("L1"), 1, if(issue."Target Maturity Level".value.equals("L2"), 2, if(issue."Target Maturity Level".value.equals("L3"), 3, if(issue."Target Maturity Level".value.equals("L4"), 4, if(issue."Target Maturity Level".value.equals("L5"), 5, 0)))))}} / 5

 

 

the following is the Log for the error showing : 

 

Field value changed06/18/2025, 14:33:36
Expand
Edit work item06/18/2025, 14:33:36
Collapse
Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number.
Current Score: set the "Current Score" field: * 2 / 5, Target Score: Set the "Target Score" field: * 4 / 5
Re-fetch work item data06/18/2025, 14:33:37
Expand
Log action06/18/2025, 14:33:37
Collapse
Log
Weight %: 11.0 Current Maturity Level: L2 Target Maturity Level: L4

2 answers

0 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.
June 18, 2025

Hi @Khalid El-Bialy -- Welcome to the Atlassian Community!

First, what version of Jira are you using: Cloud, Server, or Data Center.  That impacts the supported features of automation rules.

 

Next, I recommend pausing to review the documentation for how math expressions work with smart values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

Reading this you will find several things in your expression are not valid syntax.

 

Finally, as your maturity custom fields' dropdown values contains the number with an "L" character prefix, that could be removed and the result used in the math expression.

 

Putting that all together, perhaps try this expression, assuming your fields all have values selected and that your smart values are correct:

Current Score:

{{#=}}0{{issue."Weight %"}} * 0{{issue."Current Maturity Level".value.substringAfter("L")}} / 5{{/}}


Target Score:

{{#=}}0{{issue."Weight %"}} * 0{{issue."Target Maturity Level".value.substringAfter("L")}} / 5{{/}}

 

And, if you need to manage the significant digits, perhaps add the ROUND() function to the expression.

 

Kind regards,
Bill

Khalid El-Bialy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2025

@Bill Sheboy  thank you for your response, I Am using Jira cloud, it is also team managed where i have no admin privileges, I can only configure some field in my project and all but that's it, i cannot change the filed it self to number or any , actually by applying your rule this is the closest i have had so far, it is now executing the equation and showing the correct result in the log only, however in the "current score" field it is returning "0" but it is still failing, the following is the log : 

 

Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number.
Current Score: Current Score: 4.4

debug: Current Score: 4.4

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.
June 19, 2025

For more context, please post images of:

  • your complete rule,
  • the rule action where you try to update the field, and
  • the audit log details showing the rule execution

 

Khalid El-Bialy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 19, 2025

@Bill Sheboy 

attached the Epic config field, Rule builder, and log, 

 

BElow is the action added to edit the field current and target score.

 

Current:

Current Score: {{#=}}0{{issue."Weight %"}} * 0{{issue."Current Maturity Level".value.substringAfter("L")}} / 5{{/}}

 

Target:

Target Score: {{#=}}0{{issue."Weight %"}} * 0{{issue."Target Maturity Level".value.substringAfter("L")}} / 5{{/}}

Debug:

debug: Current Score: {{#=}}0{{issue."Weight %"}} * 0{{issue."Current Maturity Level".value.substringAfter("L")}} / 5{{/}}

 

rule.jpglog.jpgDCX1.jpgcurrent maturity dropdown config.jpg

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.
June 20, 2025

Ah, you added the prefix text I put on the number calculation.  For example, "Current Score: "

When setting the number value in the Edit Work Item action, only include the math expression, such as:

{{#=}}0{{issue."Weight %"}} * 0{{issue."Current Maturity Level".value.substringAfter("L")}} / 5{{/}}

Like # people like 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.
June 18, 2025

Hi @Khalid El-Bialy 

Welcome to the community.

Try using, issue."Current Maturity Level".value.replace("L1","1")

Or try {{issue.myCustomField.value.asNumber}}

Khalid El-Bialy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 19, 2025

that did not work as well 

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.
June 20, 2025

HI @Khalid El-Bialy 

On the edit action ,instead of using the field names, use the customfield_id.

So:

Current Score: {{#=}}0{{issue.customfield_xxxxx}} * 0 {{issue.customfield_xxxxx.value.substringAfter("L")}} / 5{{/}}

 

Find custom field ID; learn-multiple-methods-to-obtain-custom-field-ids-for-jira-and-jira-service-management-products 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events