Using ScriptRunner "Copy custom field values" function, I'm trying to copy values from a text field to a number field. I've confirmed that all issues in my filter results have a numeric value in the text field, but the script does not modify any issues. Will this ever be supported?
If I remember right, you have to cast as double. Did you try that?
Er, I should add that while I don't think this is directly supported in Scriptrunner, I've gotten around this before by making a scripted field that gets the value from the text field as a number (return (something) as Double), and then you can use the built in function to copy over the data.
Here is code for script postfunction provided by ScriptRunner plugin
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.MutableIssue import java.text.DecimalFormat CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); DecimalFormat decimalFormat = new DecimalFormat(); issue.setCustomFieldValue( customFieldManager.getCustomFieldObjectByName("number field name") , decimalFormat.parse ( (String) issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("text field name"))).doubleValue() )
I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs