setting list field value in script runner post function

RamamandA August 18, 2014

Hi,

I am using Jira 6.2.7. I am trying to set value of a list field using script runner post function. I have tried below code. However option is always returned as null. I do have value 'Jira-Tier1' defined in the list with other values. There are no errors in the log. Thanks for your help!

def optionsManager = componentManager.getComponentInstanceOfType(OptionsManager.class)
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Assignee Group'}

if(cf != null){
def fieldConfig = cf.getRelevantConfig(issue)
def option = ComponentAccessor.optionsManager.getOptions(fieldConfig).find {it.value == 'Jira-Tier1'}
log.debug ("Options is ${option}")
issue.setCustomFieldValue(cf, option)
issue.store()
}

Rama

2 answers

0 votes
RamamandA August 18, 2014

Thanks Jamie! I did verify the value and also read the value of that field in the script and printed it. I don't see any spaces. Any other pointers?

Appreciate your help!

0 votes
JamieA
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.
August 18, 2014

You might have a space after "Jira-Tier1" or something...

RamamandA August 18, 2014

Thanks Jamie! I did verify the value and also read the value of that field in the script and printed it. I don't see any spaces. Any other pointers?

Appreciate your help!

JamieA
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.
August 19, 2014

You should edit the issue using com.atlassian.jira.bc.issue.IssueService#validateUpdate

RamamandA August 19, 2014

Hi Jamie,

I would appreciate if you could help me with an example if possible? I am a begineer in this area and struggling a bit to get this working.

Thanks for your help!

Rama

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events