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
How are you defining the new field? Are you using a plugin like Scriptrunner which allows you to define calculated fields?
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And you created the new field in Scriptrunner?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the problem is with the select list. You have to convert the numeric values to actual numbers before performing the arithmetic operation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.