Forums

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

muliple select list scripted field

gagan m s March 5, 2019

Hello,

im trying to update the multi select list using script runner.

below is my script.

def cf = customFieldManager.getCustomFieldObject("customfield_12345")

def option = optionsProgManager.getOptions(fieldConfig).find {it.value == "4"}
def currentOptions = issue.getCustomFieldValue(cf)
issue.setCustomFieldValue(cf,[option])

however the script updates the value only on view screen.

and if we edit or export the issue the old value remains.

1 answer

1 accepted

0 votes
Answer accepted
Hector
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2019

Hi @gagan m s , 

You would need to use ChangeHolder class to ensure and store your script/person execution the code, can actually change it. See and example as follows:

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
cf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf), value), changeHolder)

This was answered here as well.

Hope it helps!

gagan m s March 5, 2019

@Hector,

thank you so much :)

Suggest an answer

Log in or Sign up to answer