The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner - Set existing select field value

Kristian Koniarz
November 24, 2020

Dear Community,

I got an single select field with 3 pre-configured options.

def availableOptions = ComponentAccessor.optionsManager.getOptions(customField.getRelevantConfig(issue))
return availableOptions

How can I set one of those, without creating a new value in a post function?

Like, pseudo code:

if (A == B) {

if (A == B) {
set single select field to option 2
} else {
set single select field to option 3
}

Best,

Kristian

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Raziman Dom - Ricksoft
Community Champion
November 25, 2020

Hi @Kristian Koniarz

This article "Set a Default Option on a Select List" a good reference if you want to set a value to a single list:

Then you just need to apply your if-else statement logic to that script.

Where do intended to run this script?

What do you mean by "without creating a new value in a post function"?