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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Jira Custom Field Select2 problems

I try to add a new custom field to Jira Issues. And I’ve faced few problems.

  1. JS code of Select2 becomes available and works only by inserting script below in a velocity edit file. 
     and other similar methods doesn’t work. Why? How I can fix it?
    <script type="text/javascript"> 
    AJS.toInit(function () {
  2. If I use script above, custom field with Select2 will mostly work correct. But in Issue Screen when I try to add my field by menu “Admin->Add field”, bottom “Submit” will change design and won’t be work. You can see a screen below. Field will not added. What’s the problem?

My edit velocity file code:

#controlHeader ($action $ $ $fieldLayoutItem.required $displayParameters.noHeader)
<form class="aui" style="width: available">
<script type="text/javascript">
AJS.toInit(function () {
<select class="js-example-placeholder-single js-states form-control" name="$" id="$" style="width: inherit">
#foreach ($option in $options)
<option value="$option">$option</option>
#controlFooter ($action $fieldLayoutItem.fieldDescription $displayParameters.noHeader)

 My atlassian-plugin.xml web-resource dependencies:

<web-resource key="aui-fields-resources" name="aui-fields Web Resources"> 
<resource type="download" name="aui-fields.css" location="/css/aui-fields.css"/>
<resource type="download" name="aui-fields-js.js" location="/js/aui-fields-js.js"/>
<resource type="download" name="images/" location="/images"/>

Jira v.8.19.1 (Server), Atlassian SDK v.8.2.7

1 comment

I solved both issues.
If somebody have a same problem, you'll read a text below.

1. Use this tutorial. Since JIRA 5.0 WebResourceManager is no longer supported.

2. I removed <form></form> wrapper and the button started working.

Like Ignat likes this

Hi Alex.

I'm trying to use this solution but my field does not pick any options.

Screenshot 2022-05-10 183755.jpg

could you share the final versions of your js and vm files?

the solution was to use for multiselectCF

#foreach( $option in $configs.options )

instead of 

#foreach ($option in $options) 

btw i've added some check for disabled options/ complete template looks like

#customControlHeader ($action $ $
$fieldLayoutItem.required $displayParameters $auiparams)
<script type="text/javascript">
AJS.toInit(function () {
<select class="js-example-placeholder-single js-states form-control" id="$"
multiple="multiple" name="$">

#foreach( $option in $configs.options ) )
#if (!$option.disabled || $option.disabled == false) ||
($value && $value.contains($option.optionId.toString())))
<option value="$option.optionId"
#if ($value && $value.contains($option.optionId.toString()))
#customControlFooter ($action $ $fieldLayoutItem.fieldDescription $displayParameters $auiparams)


Log in or Sign up to comment