Code: Select all
function subSegment() {
var intIndex = 0;
var segment = Xrm.Page.getAttribute("new_segment").getText();
var subSegmentOptionSet = Xrm.Page.ui.controls.get("new_subsegment");
var optionsSets = subSegmentOptionSet.getAttribute().getOptions();
subSegmentOptionSet.clearOptions();
if (segment == "A") {
subSegmentOptionSet.addOption(optionsSets[1]);
subSegmentOptionSet.addOption(optionsSets[2]);
subSegmentOptionSet.addOption(optionsSets[3]);
}
else if (segment == "B") {
subSegmentOptionSet.addOption(optionsSets[4]);
subSegmentOptionSet.addOption(optionsSets[5]);
}
else if (segment == "C") {
subSegmentOptionSet.addOption(optionsSets[6]);
subSegmentOptionSet.addOption(optionsSets[7]);
subSegmentOptionSet.addOption(optionsSets[8]);
}
else if (segment == "D") {
subSegmentOptionSet.addOption(optionsSets[9]);
subSegmentOptionSet.addOption(optionsSets[10]);
subSegmentOptionSet.addOption(optionsSets[11]);
}
else if (segment == "E") {
subSegmentOptionSet.addOption(optionsSets[12]);
subSegmentOptionSet.addOption(optionsSets[13]);
subSegmentOptionSet.addOption(optionsSets[14]);
}
}