How to set values to a Multi Select field programatically?

I need to set values to a multi select field from a jira postfunction. I dont know which method/s is necessary.

Somebody help me?


2 answers

1 accepted

2 votes
Mizan Community Champion Mar 14, 2012
CustomField customField = customFieldManager.getCustomFieldObjectByName( "name_of_cf" );

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();

//Update the custom field value
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), newValue),changeHolder);

I am not sure but multiselect customfield values are in the form of List so in the above code the newValue will be a List or array example :[1,3,4] will set the value of the mulitiselect list to first third and fourth values.

IIRC it will be a list of Option objects. You can get the Options from com.atlassian.jira.issue.customfields.manager.OptionsManager.

Could you please extend the explanation of how to get the OptionsManager and set values?

Im not able to do it.


OptionsManager optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)

srcFieldValue = optionsManager.getOptions(fieldConfig)?.find{it.toString() == srcFieldValue?.toString()}
cfTarget.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cfTarget), srcFieldValue), changeHolder)
Hopefully that will give you a pointer. Don't have a java example.

I have combined both responses and I am able to do it.


Great, can you vote up my comments then if you found them helpful, thanks.

If you were abel to find the solution and if possible would please share it ?

I am also trying to figure out same problem. I have opened ticket here:


You're asking a completely different question... SOAP vs java API.

Exactly, Jamie is wright. My solution is valid if you are using Jira Java API, but you are asking for SOAP client application.

Anyway, by using

customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), newValue),changeHolder);

where "new value" is a Collection of Option objects yo can set the value of the multi-select.

Thank you for responding. I have not been able to find solution for my problem yet and have not heard from any other developers too. Thanks for the info.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

78 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you