Hi All,
I’m new to groovy scripting. I tried multiple options to create a calculated field which should divide the two custom field values.
First field is single select with Numeric values.
second field is number field.
new field = first field / second field
Any help would be greatly appreciated.
Thanks in Advance
Anil
Yes. We are using ScriptRunner. I am new to Groovy Scripting.
How did you define the new field (the one that is meant to be the quotient of the other two fields)? Can you give me a screenshot?
This is what i was trying:
import
com.atlassian.jira.component.ComponentAccessor
cfA = issue.get(customfield_1234)
cfA = issue.get(customfield_1234)
return cfA / cfB
And you created the new field in Scriptrunner?
Yes. I have created new field using scriptrunner.
Somehow I'm able to add two number fields. But not able to make it with select list with numeric values and another number field.
I think the problem is with the select list. You have to convert the numeric values to actual numbers before performing the arithmetic operation.
That is where i stopped. Do you have any inputs on how to convert?
An example of this is found in this Community topic: https://community.atlassian.com/t5/Jira-questions/Copy-Select-List-field-single-select-to-a-number-field-in-Jira/qaq-p/1351638