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

How to retrieve the option id of the Select List (single choice) custom field

I'm trying to conditionally update by post function a single choice select list.

When doing it by post function copy cf value from field to field - in certain cases it's being updated textually but in a two dimensional gadget for these values I can see that this issue is in "None" value.

Trying to do so by a scripted post function too - but I can't find the option_id's for its optional values.

I can see that this something like "cusomfield_xxxx-val" and then the text of the value.

 

Thanks

1 answer

1 accepted

4 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2016

You need to get and set an option object, not a string or id.

The snippet I used for fetching one should get you going:

def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("My colour list")

def fieldConfig = cf.getRelevantConfig(issue)

def value = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.toString() == 'Red' }

 

 

Hi,

What if the issue is on creation phase ?

I tried this method in init behaviour, for create issue, it didn't work

Thanks in advance,

I have the same question also.
During issue creation, there is no "issue" object to pass into getRelevantConfig function. How do we get the fieldConfig without "issue" object?

def fieldConfig = cf.getRelevantConfig(??no issue object during create??)

thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events