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!


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

Suggest an answer

Log in or Sign up to answer

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?



AUG Leaders

Atlassian Community Events