Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

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

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

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!

Leaderboard

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
4,464,570
Community Members
 
Community Events
176
Community Groups

Add value to select list custom field

 

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

2 answers

0 votes

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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events