Hello Everyone, We are using Jira 7.6.4 and Scriptrunner 5.4.11, The task is to autopopulate a Selectlist customfield in Jira on the target issue. I have tried variuos scripts from the blog but none of them are working for me. Is something changed on Scriptrunner plugin recently? Can someone help me to get the correct script including the correct packages.
I have tried the below scripts:
CustomField customField = customFieldManager.getCustomFieldObject("customfield_17100");
OptionsManager optManager = ComponentAccessor.getOptionsManager();
Options options = optManager.getOptions(customField.getRelevantConfig(issue), null));
Option newOption = options.getOptionById("Campaign"); // Check your option id
ModifiedValue mVal = new ModifiedValue(issue.getCustomFieldValue(customField), newOption );
customField.updateValue(null, issue, mVal, new DefaultIssueChangeHolder());
===============*=======================
import com.atlassian.jira.component.ComponentAccessor
def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Solution")
def cfConfig = selectCf.getRelevantConfig(issue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
it.toString() == 'Campaign'
}
issue.setCustomFieldValue(cfSelect, value)