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

convertToSingleSelect behaviour


We use convertToSingleSelect in two ways:

1. With a static list of values set in the script of the REST endpoint that the converted field is linked to - useful when we need a hideable single select list.

2. With an endpoint that is connected to an external database - to get data that can be updated by users that are not Jira admins but have access to that external database.

In the first scenario this behaviour is working like this:

When you select an option from the list that option is no longer accessible if you want to change selected option. So with every option that you select, the list is becoming shorter and shorter. 

In the second scenario when you select an option you cannot change it at all because the list becomes empty. You need to reload whole form to see full list again.

Is it possible to configure such converted field to behave the same way as a normal single select list? So all values remain in the list no matter how many times a user changes his mind while reporting new ticket. 



3 answers

1 accepted

2 votes
Answer accepted


For your first scenario, this should be possible. Could you please send me an example of the code you're using currently? I might be able to see where you need to make changes. 

For the second, you might take a look at this example:

Or, there are several other select list conversion examples here:


Hi Jenna,

In the first scenario we use following behaviour to convert a text field to single select list:

def score = getFieldById("customfield_16403")

ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/scores",
query: false,
formatResponse: "general",
css: "max-width: 500px; width: 500px",

And a simple custom endpoint:

import groovy.json.JsonOutput
import groovy.transform.BaseScript
import javax.servlet.http.HttpServletRequest

@BaseScript CustomEndpointDelegate delegate

class pozycja {
def value
def label

scores () { MultivaluedMap queryParams, String body,HttpServletRequest request ->

def lista = ['1','2','3','4','5']
def result = []
def map = [:]

lista.each {
result << new pozycja(value:it, label:it)

map.put('items', result)


As for the second scenario -  I have looked into your examples (without it I couldn't make it running in the first place;) ) but I haven't found anything to make it work exactly as a true single select list.




Here's a simple example of a REST endpoint that does something similar to what you're wanting (for your first question) :

import groovy.json.JsonBuilder
import groovy.transform.BaseScript


@BaseScript CustomEndpointDelegate delegate

doSomething() { MultivaluedMap queryParams ->

    def query = queryParams.getFirst("query") as String
    def fullList = [:]
    def originalList = ['A', 'B', 'C'] // test list, put your list here!    
def list = [] if(query){ def length = query.length() originalList.each{ if(it.substring(0, length) == query){ list.push(it) } } } else{list = originalList} fullList = [ items: list.collect { [ value: it, html : it, label: it, ] }, ] return Response.ok(new JsonBuilder(fullList).toString()).build() }

 And here's the behaviour that goes with it:

    ajaxOptions: [
        url : getBaseUrl() + "/rest/scriptrunner/latest/custom/doSomething", 
        query: true, // keep going back to the sever for each keystroke        
minQueryLength: 1, keyInputPeriod: 500, formatResponse: "general", ] ])

My example probably needs some more intensive error handling added, so if something causes it to break keep that in mind. Hopefully that will help you out with your first question!

As far as querying the database, I'm not sure what you mean by making it a true single select. Can you send what you're doing currently?


Like Yoav Ashkenazi likes this

Wow, that is clever! Thanks a lot, Jenna! I will try to implement this approach also to our second scenario (with a database).

Hello @Bartek Zukowski  and @Jenna Davis ,

I have tried the above Rest Endpoint and behaviour, but it is not working for me.

Could you please help.

Thanks and Regards,

Swapnil Srivastav.

Hello @Bartek Zukowski  and @Jenna Davis ,

I want to create a customized select list where the options are:

<value of a custom field in the particular issue><space><summary of the same issue>

and the no of options should  be same as the no of issues in a particular project which should be updated dynamically whenever a new issue is created.

Could you please help me.

Thanks and Regards,

Swapnil Srivastav

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

330 views 2 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you