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: 

Read the values from a custom field

Nikola Perisic
Community Champion
May 27, 2024

Hi community! Recently, I've started to explore scriptrunner for DC and I am wondering how to read the values of a custom field. Here's the code:

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.altassian.jira.issue.fields.CustomField;

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def customField = customFieldManager.getCustomFieldObject("customfield_10201");

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Umut Ekin AL
Contributor
May 27, 2024

Hello @Nikola Perisic ,

 

As I see the question that you asked, you need this code for DC, you can use the code block below.

def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(fieldToCopyId)
def linkedIssueCustomFieldValue = parentIssue.getCustomFieldValue(customField)

 Also you chose the deployment type Cloud version, you can use this link for the cloud.

 

Please let me know if this helps,

Umut

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events