Hi,
I have a working REST endpoint script which allows me to reload a very large number of single select options. This is required to periodically reload options which come from an external SAP system and contains many thousands of options. The script is executed from within an Excel spreadsheet and performs these functions for a single select custom field:
1. Disable all existing options
2. For each row in the spreadsheet:
a. Check if the existing option already exists in the select list.
b. If found, enable the option
c. If not found, add the option
3. Sort options
Now... I have a similar requirement for a cascading select. My problem is that while I can iterate through the parent level options, I can't see a way to iterate the child options. The code below only finds the parent option, the child options size is always 0 (the cascading select DOES have child options) and no child option is ever returned.
private Option getChildOption(List<Option> rootOptions, String value) {
for (Option parent : rootOptions) {
log.info("Parent=" + parent.getValue())
if (parent.getValue().equals(value)) {
List<Option> childOptions = parent.getChildOptions();
log.info("Child options size=" + childOptions.size())
for (Option child : childOptions) {
log.info("Child=" + child.getValue())
return child;
}
}
}
return null;
}