Hi ,
I have a list of 3000 records and trying to add to a custom field but the values are not populating .Custom field is a label.
def populateCustomField(List carIDAppList){
def projectMgr = ComponentAccessor.getProjectManager() as CachingProjectManager;
IssueContextImpl issueContext = getIssueContext() as IssueContextImpl;
//IssueContextImpl issueContext = IssueContextImpl.getIssueContext() as IssueContextImpl;
def customeFieldMgr = ComponentAccessor.getCustomFieldManager() as CachingCustomFieldManager
def customeField = customeFieldMgr.getCustomFieldObject(customFieldId);
FieldConfig fieldConfig = customeField.getRelevantConfig(issueContext);
def optManager = ComponentAccessor.getOptionsManager() as DefaultOptionsManager;
OptionsImpl optionsImpl = optManager.getOptions(fieldConfig) as OptionsImpl;
List<Option> lists = new ArrayList();
Long opId = 1L;
carIDAppList.each {
if (optionsImpl.getOptionForValue(it.toString(), null) == null) {
Option option = optManager.createOption(fieldConfig, null, opId, it.toString());
opId += 1L;
lists.add(option);
}
}
if (lists.size() > 0) {
optManager.updateOptions(lists);
}
}