Forums

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

Read the values from a custom field

Nikola Perisic
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events