Forums

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

How do I get all custom fields value of an issue using project key?

Ramesh Lakshmanasamy June 13, 2018
I want get all custom field value from issue through project key using Java class

2 answers

1 vote
Mark Markov
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.
June 13, 2018

Hello @Ramesh Lakshmanasamy

If you need to get values of all customfields of issue, it would be like this:

import com.atlassian.jira.component.ComponentAccessor;

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = issueManager.getIssueObject("issuekey")
def cFields = customFieldManager.getCustomFieldObjects(issue)
Map<String, Object> fieldvalues = new HashMap<String, Object>()
cFields.each {it -> fieldvalues.put(it.name, issue.getCustomFieldValue(it))}
log.error("FIELDS :"+ fieldvalues)
0 votes
Alexey Matveev
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.
June 13, 2018

Hello,

It would be like this

import com.atlassian.jira.component.ComponentAccessor;

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_10304")
def issue = issueManager.getIssueObject("issuekey") def cFieldValue = issue.getCustomFieldValue(cField)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events