Get MultiSelect CustomField Values

Pushparaj Bhaskaran May 13, 2014

Hi

I need to get the selected values for a Custom Multiselect field. Had searched the forums but there is no concrete answer for the same.

2 answers

1 accepted

0 votes
Answer accepted
Bhushan Nagaraj
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.
May 13, 2014

Refer to

https://developer.atlassian.com/static/javadoc/jira/6.2.1/reference/com/atlassian/jira/issue/fields/CustomField.html#getValue%28com.atlassian.jira.issue.Issue%29

Multiselects will return a list of Option. You can try something like this.

CustomField customField = customFieldManager.getCustomFieldObjectByName("name_of_cf");

List<Option> options = (List<Option>) customField .getValue(issue);

Pushparaj Bhaskaran May 13, 2014

Great Thanks, but how to determine the options that are actually selected by the user.

Pushparaj Bhaskaran May 13, 2014

List<Option> options = (List<Option>)cfmselect.getValue(issue);
for (int i = 0; i < options.size(); i++) {
Env=options[i] + " " + Env

}


Added the above solved the issue. Thanks

Like Raj Hazarika likes this
J Manas Kumar February 6, 2020

Hi @Pushparaj Bhask 

 

Need your help on this.

I have the same requirement , what i need is when ever i have added something in a custom field which is a multi select in an EPIC issue , its parent(which also contains same custom fields which values , but doesnt contain all new values or unique values which are there in its child issue) should get updated with the unique value or new value in the parent issue's custom field.

I have tried with Listener , but unable to do it.

Can you help me on this code? you have created a behavior or Listener for this? can you provide help me for the code? Any help will be appreciated.

 

Thanks & Regards

Manas

0 votes
codelab expert
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.
May 13, 2014

In Javascript do something like this

var selectedOptions = AJS.$("your_multiselect_component").val();

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events