Hi
I have a select list(single choice) custom field and a script that returns active sprint for a project, I want this active sprint in any time add to select list(single choice) custom field,
How do I do?
I don't know how add value to SelectListCF with groovy.
thanks
This may not be 100% the best implementation for your use case given how few details you shared, but it is possible to add options to a SingleSelect field using a script.
You would use this API: OptionsManager.createOption
You could add an event listener that watches for "Sprint Created" and will add the newly created sprint to the correct field config. The challenge may be in detecting the correct project and field config to add the sprint to.
The other danger with this approach is that the list of options for your Select List will continually grow and eventually will cause performance problems.
The option suggestion by Fabio may be a better solution.
Hi @MG ,
you have a Select List custom field with some values and you want to add a value retrieved by a script dinamically.
You can't add a value dinamically to a Select List field. You should be able, through a script, to hide some values specified for the field but not add a new value dinamically.
In order to do that, in my experience, you need to create a text field custom field and, through a behaviour, transform it in a select list that aggregate values from your original select list and your script for active sprint.
Take a look to the following doc https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.