Forums

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

Script Runner: groovy postfunction get customfield value

jollroy March 24, 2021

hi all,

i'm trying to get customfield value but running is error. the customfield type is string script running is ok,but customfield type is select list running report error

def contactTypeCF = customFieldManager.getCustomFieldObject("customfield_10405")

def contactValue= issue.getCustomFieldValue(contactTypeCF )

======= the customfield type is string running ok 

 

 

1 answer

0 votes
Tansu Akdeniz
Community Champion
March 24, 2021

Hi @jollroy 

Welcome to community.

What is the error? It seems fine indeed.

Try to test in script console for specific issue whose cf is not null. It should return select list value as string.

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager();

def issue = ComponentAccessor.getIssueManager().getIssueObject("ABC-123");
def contactTypeCF = customFieldManager.getCustomFieldObject("customfield_10405");
def contactValue = issue.getCustomFieldValue(contactTypeCF)

jollroy March 24, 2021

微信图片_20210324172402.png

jollroy March 24, 2021
def issue = ComponentAccessor.getIssueManager().getIssueObject("ABC-123");

issue is post function default variable.don't get it.

Suggest an answer

Log in or Sign up to answer