Automation to divide two custom numeric fields

Dionei Piazza
Contributor
September 21, 2021

I need to get the result of divide two custom fields I created in Jira. I'm using automation with smart values. This is the syntax:

{{issue.customfield_10136}} / {{issue.customfield_10135}}

With this sintaxe I get this error message in 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.
         Desvio Estimativa: ( / 6.0)

No fields or field values to edit for issues (could be due to some field values not existing in a given project):
TES-46
========================================


Any help appreciated!

4 answers

1 accepted

0 votes
Answer accepted
Robert Wen_Cprime_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

Do you have default values if the custom fields aren't set?  e.g. issue.customfield_10136 should be 0 if not set and issue.customfield_10135 should be 1 if not set.

Dionei Piazza
Contributor
September 22, 2021

Wow! It works now!

Thank you @Robert Wen_Cprime_ 

0 votes
Haley Soltau
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!
March 8, 2024

I know this is old but as I was looking for this myself, I thought I would come back and share the answer.  

This is what you need to put into your smart value calculation
{{#=}}{{issue.customfield_10136}} / {{issue.customfield_10135}}{{/}}

The begin and end symbols are what lest Jira know you actual want it to compute.

Everything can be found here...
https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html

Harsh
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.
May 13, 2024

Hi @Haley Soltau 

II am using the same thing but unfortunately this does not work for me. I am using JIRA Server/DC. And I am performing the action on EDIT, i.e. after creation
Could you please help me out here. Thanks a lot. 

I get the following error

Error rendering smart-values when executing this rule:
Missing parameter(s) for operator /: 25 /
Where 25 is the value for number field A
and I am dividing by 5 which is the value for number field B.

I am expecting a result of 5 here
Thanks in advance.
0 votes
Natalia Matsyuk September 28, 2023

A bit unrelated math function, but I found this video helpful: https://www.youtube.com/watch?v=Pi7_CInMTQc&ab_channel=ApetechTechTutorials

Robert Wen_Cprime_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 28, 2023

Yeah, @Alex Ortiz is good with his videos from Apetech Tutorials.

0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

Hi @Dionei Piazza

Can you share what the type of customfields are the ones you are using for the calculations including the one with the formula?

Thanks,

Dionei Piazza
Contributor
September 21, 2021

Hi @Fabian Lim 

All Number fields.

Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

Ok, never seen this error message, but can you confirm that the customfield does not have a context that blocks it from the TES project? Also make sure that the field is added to the screens of the issue type.

Dionei Piazza
Contributor
September 21, 2021

The field appears in the screen.

If I set manual values in the automation it works. For example 4 / 2. In this case, it work fine!

But when I use the sentence {{issue.customfield_10136}} / {{issue.customfield_10135}}, it doesn't work.

:(

I've try this way {{issue.customfield_10136.divide(issue.customfield_10135)}},

this way {{issue.customfield_10136.divide(issue.customfield_10135).floor}}, but it doesn't work...

Suggest an answer

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

Atlassian Community Events