Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set multiselect options for an Issue using Java (SDK)

VikasBasra April 18, 2014

How to set multiselect options for an Issue using Java (SDK). Can someone share a sample code please.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
VikasBasra April 18, 2014

I am trying to update Custom Filed Value on an Issue through a custom Plugin.

Custom Field is of type multi select dropdown

I have a groovy script whcih does this easily as below. However I need to move this inside a custom plugin. Not sure what should be the corresponding code for it in Java.

def optionsManager = componentManager.getComponentInstanceOfType(OptionsManager.class)

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'CUSTOM FIELD NAME'}

if(cf!=null)

{

def fieldConfig = cf.getRelevantConfig(issue)

def option = optionsManager.getOptions(fieldConfig).find {it.value == businessUnit.toString()}

def currentOptionsBusinessUnit = issue.getCustomFieldValue(cf) ?: []

issue.setCustomFieldValue(cf, currentOptionsBusinessUnit + [option])

}

0 votes
Daniel Wester
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.
April 18, 2014
What are you trying to do? Are you creating new issues? Updating issues?
TAGS
AUG Leaders

Atlassian Community Events