Script Runner, Groovy, JIRA, How to retreive the value of the custom field with groovy?

guis January 31, 2013

Hello,

I develop a script groovy, I would like know how I retreive the value of custom field present in the issue?

Guis

2 answers

0 votes
DanielG
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.
January 31, 2013

For example:

I want to CF 'TestCustomFieldA', make a script that sum +1 to value of another CF called 'TestCustomFieldB'. You have to make this script and apply in TestCustomFieldA:

def test = getCustomFieldValue("TestCustomFieldB")

if (test) {

float number = TestCustomFieldB.getValue()

number = number + 1

return number

}

else{

return null

}

0 votes
Jozef Kotlár
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.
January 31, 2013

You probably mean script in context of script runner plugin, so

def cfX = ComponentAccessor.customFieldManager.getCustomFieldByObject("X")
def value = issue.getCustomFieldValue(cfX)

Suggest an answer

Log in or Sign up to answer