Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×Hi all, I'm developing a jira plugin custom field extends SelectCFType class, and I Override the OptionsManager.getOptions() function, but when I refresh the portal, the options will be rendered repeatedly like below. Could anyone solve this?
And here's my getOptions funciton.
@Override
public Options getOptions(FieldConfig fieldConfig, JiraContextNode jiraContextNode){
try {
List<Option> options = new ArrayList<>();
IQLFacade iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(IQLFacade.class);
String iql = "Key != \"\"";
List<ObjectBean> assets = iqlFacade.findObjects(iql);
log.debug(assets.toString());
for(ObjectBean asset : assets){
String key = asset.getObjectKey();
Integer id = asset.getId();
log.debug(key);
log.debug(id.toString());
options.add(ComponentAccessor.getOptionsManager().createOption(fieldConfig,null,Long.valueOf(id),key));
}
log.debug(options.toString());
return new OptionsImpl(options,fieldConfig,ComponentAccessor.getOptionsManager());
} catch (InsightException e) {
throw new RuntimeException(e);
}
}
Any adivce will be appreciated. Thanks in advance.
Hi @Wenjing Liu
The root cause of the problem is the line below:
options.add(ComponentAccessor.getOptionsManager().createOption(fieldConfig, null, Long.valueOf(id), key));
@Override
public Options getOptions(FieldConfig fieldConfig, JiraContextNode jiraContextNode) {
List<Option> existingOptions = ComponentAccessor.getOptionsManager().getOptions(fieldConfig);
return new OptionsImpl(existingOptions, fieldConfig, ComponentAccessor.getOptionsManager());
}
Oh I see. I solved this problem using your method. Thanks very much!
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.
Thanks very much for your advice! And I'm sorry that I have another question How to develop an Asset Picker? Could you please help me if you have some time? Any advice will be greatly appreciated. Thanks in advance!
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.