To get a multi-select custom field to behave like system multi-select fields with type-ahead and lozenges I added this JavaSecript to the Description of the field:
<script type="text/javascript">
(function($) {
// "customfield_11301" 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_11301 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 }
);
}
}
AJS.toInit(function()
{ convertMulti("customfield_11301"); }
)
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context)
{ AJS.$("#customfield_11301 option[value='-1']").remove(); convertMulti("customfield_11301"); }
);
})(AJS.$);
</script>
This worked for years, but stopped working after upgrading to Data Centre version 8.9.1. The JavaScript was just shown in text under the field in the Create Issue screen.
I found I could get the desired behaviour for multi-select fields by installing a plugin, select2 from https://marketplace.atlassian.com/apps/1220214/select2?hosting=datacenter&tab=overview
The problem remaining is that after deleting the JavaScript from the description, it is still being displayed under the field in the Create Issue screen. I tried re-indexing, but the JavaScript is still displayed although it is no longer in the Description field.