Forums

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

script - Calculated field for division

ChandrasekharKN
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 18, 2020

Hi All,

Can anyone help me with the below question?

I am trying divide the values of two custom fields and trying to show in a calculated field and i am unable to achieve this. Please let me know if i am doing something wrong

<!-- @@Formula: Integer.parseInt(issue.get("customfield_17703")) / Integer.parseInt(issue.get("customfield_17704")) -->

Also tried
<!-- @@Formula: a = Integer.parseInt(issue.get("customfield_17703").trim()) 
b = Integer.parseInt(issue.get("customfield_17704").trim()) 
return
a/v;
-->

 

 

PS: Addition and multiplication operands work fine for the same code inside the formula

1 answer

1 accepted

0 votes
Answer accepted
Alexander Pappert
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.
March 18, 2020

This is working in my jira instance

(issue.get("cf01") != null ? issue.get("cf01") : 0) / (issue.get("cf02") != null ? issue.get("cf02") : 0) 

normally, errors are shown in the jira log.
sometimes they give a really good hint what's not working with the script

ChandrasekharKN
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 18, 2020

Thank you so much. I found the solution  from the logs and fixed it. Really appreciate your help

Like Alexander Pappert likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.7.2
TAGS
AUG Leaders

Atlassian Community Events