how to set "Project Picker" custom field (with scriptrunner)

Renni Verho November 14, 2019

We have escalation script which were working ok, but now after one custom field is set as required we need to fill it f it is empty. 

custom field type is Project Picker and I tried to set values by script 

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("field name") // name of CF

if (!customField.getValue(issue)) {
def optionsManager = ComponentAccessor.getOptionsManager()
def fieldConfig = customField.getRelevantConfig(issue)
def option = optionsManager.getOptions(fieldConfig).find { it.value == 'Project: ACR' } // value of option

issueInputParameters.addCustomFieldValue(customField.id, option.optionId as String)
}

by some reason I cannot get match to project in def option. 

what would be correct way to set project picker field ? 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events