It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to add dynamic options to a single select list field

I have a requirement of a select list custom field for a particular project which can have dynamic options such as:

There is a number field : Bnum

System field in jira: Summary

The option should appear like "<Value of Bnum><space><Value of summary>"

So the no of options dynamically increase with the number of issues that are created within that particular project.

e.g. Issue 1: Bnum=123

                   Summary= abcd

      Issue 2: Bnum=456

                 Summary = efgh

Then field options should be:

  • 123 abcd
  • 456 efgh

Kindly suggest a plugin or script to do so. Any help would be appreciated.

2 answers

0 votes


I will suggest nfeed plugin or scriptrunner. 

I think nfeed fit more you requirement, yiu can easily query your database to find those values to display.

Hello @Mohamed_Benziane

Thank you for the immediate response.

I checked nFeed or Elements Connect, its a paid plugin. I would not be able to use that.

Could you please suggest, how can it be achieved using Script Runner ?

Thanks and Regards,

Swapnil Srivastav.

Sorry but im not good at groovy code, see below the answer of @Leo 

0 votes
Leo Community Leader Nov 04, 2019


Basically it's bad idea of giving more options/space to all to add new values to select list field. you'll end up with many unwanted values. you can consider labels 


But if you still want to go ahead

You can go with ScriptRunner's Custom listener. on your case listener for Issue created event

I'm attaching sample snippet for your reference you may need to modify some lines here

1. Getting custom field and append with summary value

2. updating user should have valid permission. if not you can use particular user id in the script who is having the permission to modify field values

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def issueService = ComponentAccessor.getIssueService()

def issue = event.issue
def value = issue.summary as String
def updField = customFieldManager.getCustomFieldObjectByName("Field name for which you want to add new values/options")

def fieldConfig = updField.getRelevantConfig(issue)
def currentOptions = optionsManager.getOptions(fieldConfig)
def newSeqId = currentOptions*.sequence.max() - 1
def option = optionsManager.createOption(fieldConfig, null, newSeqId, value)

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
addCustomFieldValue(updField, option.optionId.toString())
addCustomFieldValue(value, null)
def updateValidationResult = issueService.validateUpdate(currentUser,, issueInputParameters)
if (updateValidationResult.isValid()) {
issueService.update(currentUser, updateValidationResult)
else {
log.warn("Failed to update issue: ${issue.key}: ${updateValidationResult.errorCollection}")




Hello @Leo ,

Thank you for the response. 

I am going to try the script you have suggested. However, I need to display the options on Create screen and let the user choose the desirable option. 

The scenario is, I need the summary and value of Bnum (Number field) of previous created issues in the project and then concat them to form a string and display that string as options. So when there are 500 existing issues in the project, when the 501(th) issue is being created, the field should be displayed on the Create screen with 500 options of <Bnum><space><Summary>, each with the previous issues' Bnum and Summary.

I understand that it is not wise to have so many options in a single field and I am trying for some other approach as well, in the meantime, I need this functionality to work.

Thanks and Regards,

Swapnil Srivastav

Hello @Leo , PFB link:

(Here, I have mentioned the Behaviour Script that I have used).

Kindly have a look and let me know, where am I going wrong.

Thanks and Regards,

Swapnil Srivastav.

Leo Community Leader Nov 04, 2019


I'm not sure what is the issue/error you are getting.

but when I look the flow of your code seems to be not good practice.

Why because for each and every time your number field changes you are running JQL query for all existing issue and adding them as values to your select list field. 

E.g. for the first time it'll add 10 values for 10 existing issues and if I update number field on anyone of those issues your script will search for all 10 issues and add them again.


I never tried code for updating existing option(s) of select list field.

for your requirement the above script on custom listener(not on behavior) on issue create issue event will work. I'm just adding number field value appending snippet as well

def numField = customFieldManager.getCustomFieldObjectByName("Number Field name")
nVal = issue.getCustomFieldValue(numField) as String
def value = nVal+" "+issue.summary as String


NOTE: if you add this script for issue create event listener. while creating new issue it'll populate values till last last issue created. when create button hits this script will run and will fetch number and summary value of currently created ticket and then add it as a new option for your select list

One more thing you should note here I used currentLoggedin user(which is me, having permission to add values to select list)


For adding previous tickets values to select list you can run the same script in script console(instead of fetching current issue details run your jqlparser and add them)





Hello @Leo ,

Alright, I get your point. I agree with you.

Please let me know whether using Select List Conversions or Database picker of Script Runner will be a better approach.



Thanks and Regards,

Swapnil Srivastav

Leo Community Leader Nov 05, 2019

Which field you are going to convert to select list? summary field?

iWhat I understood was you have number field and and select list field

Fetch number field and value and summary and add that as new option to your select list field 

it's purely based on your requirement, but as per my knowledge for your above requirement there is no conversion or script field is required

1. Create Number Field

2. Create Select List field

3. Write your script in custom listener




@Leo ,

Ok, I get it.

Thank you very much for your response

Best Regards,

Swapnil Srivastav

Suggest an answer

Log in or Sign up to answer

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