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

How can I update a text field converted to select list by ScriptRunner Behaviours script?


I have a text field that I am converting to a select list using the tutorial from   The field worked great as an initialiser function, but I'd like to use the field as a server-side script for a user picker field.  When the user selects a different user with the user picker, the select list shows all issues where that user is the reporter.  I tried to do this following the tutorial under 'Dynamically Changing the Picker Query'.  The script works, but each time the user picker field is updated a new drop down box appears above the previous one.  Is there a way to remove the old drop down box?

Here is the code I am working with:

//Server-side script for user picker field

def traveler = getFieldById(getFieldChanged())
def linkedIssuesField = getFieldByName("Linked issue selection")

ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner-jira/latest/issue/picker",
query : true,

data : [
currentJql : "Reporter in (${traveler.getValue()}) ORDER BY key ASC",
label : "Which trip is this update for?",
formatResponse: "issue"
css : "max-width: 500px; width: 500px",
else {
// selected project was null - disable control
linkedIssuesField.setReadOnly(true).setDescription("Please select a reporter before entering the issue")


//Server-side script for the issue picker field
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def selectedIssueField = getFieldById(getFieldChanged())
def selectedIssue = selectedIssueField.value as String
log.debug("selectedIssue changed: ${selectedIssue}")
def selectedProject = getFieldByName("Linked issue selection").value

if (selectedIssue && selectedProject) {

def jqlQueryBuilder = JqlQueryBuilder.newBuilder()
def searchService = ComponentAccessor.getComponent(SearchService)
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

def query = jqlQueryBuilder.where().project(
if (searchService.searchCount(user, query) == 1) {
else {
selectedIssueField.setError("Issue not found in the selected project")


 Thank you

2 answers

Any news an that?

I have the same problem using a Database Picker to get all organisational units from the database. In a SR behaviour (on change) I get the selected OU and fetch all OU members from database using the convertToSingleSelect. Each time the OU is changed a new Select is appended into the DOM - I just would need the content of the dependent selectbox beeing updated.


By the way in version 5.7.1 there is still no possibility in dynamically loading a selectbox, there is only the option to filter out some preconfigured (select)options but not append new ones?



Hi @Mick Lovell 

I am trying to do quite similar to what you did. I am trying to populate the list with values from the database into 2nd element the one which we are converting to select a single value instead of calling results for issues.  

Any idea?



Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

315 views 0 10
Join discussion

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