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);
}
}
There's two problems here:
See https://docs.atlassian.com/software/jira/docs/api/7.12.1/index.html?com/atlassian/jira/issue/label/LabelManager.html probably
sorry it's not a label , it's a select list (multiple choices) and converted to a search bar .
When i tried with 30 records it was loaded .Initially it was a stand alone groovy script and then converted to a groovy class not sure if that's the issue.
class CarIDAppData extends FieldBehaviours {
static void main(String[] args) {
CarIDAppData st = new CarIDAppData();
carIDAppList =st.processCarIDdata()
st.populateCustomField(carIDAppList);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.