Forums

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

How do I access the custom field value for 'each' issue in project?

Alex Chan January 21, 2019

I want to eventually SUM a couple custom field values for a given Issue / Ticket. 

In my first iteration, I am just trying to retrieve a single custom field value.

QUESTION: How do I access issues? I want to "getCustomFieldValue(customFieldName_userPain)" for a given issue, but I'm not sure how I'm supposed to be iterating over issues.

 

import com.atlassian.jira.component.ComponentAccessor
def customFieldName_userPain = "userPain"
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def customField_userPain = customFieldManager.getCustomFieldObjectsByName(customFieldName_userPain)[0]
def score_userPain = [current_ISSUE].getCustomFieldValue(customFieldName_userPain)

return
score_userPain

 

Note: if I revise line 6 to:

def score_userPain = getCustomFieldValue(customFieldName_userPain)

I receive Null for score_userPain. I believe I'm getting null because I'm not referencing any issue in particular ... (I need a high level explanation for all of this haha) :) 

0 answers

Suggest an answer

Log in or Sign up to answer