Forums

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

Update numeric custom field value via automation rule

Jelmer Tiemessen September 9, 2021

I have a custom field of the type 'numeric'. I want to update this field within an automation rule using a scriptrunner script. I tried the following code, but it did not work...

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObject("customfield_56003")
issue.setCustomFieldValue(customfield, "new value")

Any suggestions?  

1 answer

1 vote
Martin Bayer _MoroSystems_ s_r_o__
Community Champion
September 9, 2021

Hi @Jelmer Tiemessen , if your CF is of Numeric type, you need to use value of java.lang.Double type (https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html)

Jelmer Tiemessen September 16, 2021

I think the code itself just does not work. Also text fields won't get updated using this code...

Charlie Misonne
Community Champion
November 15, 2024

Your answer saved me @Martin Bayer _MoroSystems_ s_r_o__ 

I had a hard time finding out a Double is needed :-)

Suggest an answer

Log in or Sign up to answer