Pre-selecting MultiSelect with default value using Behaviours plugin


We have a multi select list in our transition screen where it is pre-selected according to the selected values in the same select list in the parent Jira.

In Behaviour plugin, we pre-select the select list by using setFormValue function. It works but what we would like to do is displaying and converting the multi select list to an auto complete multi picker.

We use the following code to convert the select list into a auto complete multi picker by pasting the lines in the description field.

<script type="text/javascript">
(function($) {
 // "customfield_11315" is the number of the custom 
 // multiselect field you want to change as e.g. 
 // seen at the end of the "configure" page url of 
 // the field you want to change this way 
    AJS.$("#customfield_11315 option[value='-1']").remove(); //Removes the default value "None"
    function convertMulti(id){
        if (AJS.$('#'+id+"-textarea").length == 0){
            new AJS.MultiSelect({
                element: $("#"+id),
                itemAttrDisplayed: "label",
                errorMessage: AJS.params.multiselectComponentsError
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
        AJS.$("#customfield_11315 option[value='-1']").remove();

The problem here is that the auto complete multi picker doesn't display the pre-selected by the Behaviours plugin (setFormValue) in its text area. The pre-selected values aren't available in auto comlete multi picker's available (unselected) dropdown list either.. so i assume the values are actually selected but just are not displayed correctly in the multi picker's text area.

Has anyone else come across with this issue? I wonder if I could get the pre-selected option values correctly displayed in the auto complete multi picker's text area by tweaking the javascript above?

Thank you in advance!

2 answers

I suppose I must rephrase my question..

Is it possible to pre-select auto complete multi select picker and pre-populate the selected options?

Worked it out by manually setting "selected" property to the option values via jQuery script before converting the select list to auto complete multi select picker :)

it will be great if you share your solution here.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,729 views 17 21
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