how to get a custom field value from a current issue in java

jschwien January 10, 2019

Hello,

I have added a custom text field to jira called sync  and populated with a simple string 1234. I need to be able to get that value (1234) in java so I can use it to do a rest call. my question is how can I get that customfield details of the current issue im on in?

 

2 answers

0 votes
Teja June 26, 2019

@Elifcan Cakmak Hi, How to get customfield value using Java code?

0 votes
Elifcan Cakmak
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 11, 2019

Hello,

You mean with groovy script using the Jira API, right? If that so, you can do it like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField

def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("TEST-5")

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObjectByName("Testing")

return issue.getCustomFieldValue(customfield)

Regards,

Elifcan

jschwien January 11, 2019

Hello!

 

thanks for the reply! I actually using java with jira api but I will try and convert this to java and give it a try will update you with result 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events