Get default value of a Number Field

Louisa Pabst July 21, 2015

Hi,

I'm trying to get the default value of a number field. I need this deafault value for a calculation, therefore it has to be a double. The default value of weight is 0.2

def weight = Double.valueOf(issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Weight")).getValue());
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Customfield");
issue.setCustomFieldValue(cf, weight);

 

Best regards,

Louisa

1 answer

0 votes
Peter Bengov
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.
July 22, 2015

Try using .floatValue() and casting def to double by using (double).

Suggest an answer

Log in or Sign up to answer