The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

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 Champions.
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
Deleted user
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)

TAGS
AUG Leaders

Atlassian Community Events