Guest User

Untitled

a guest
Jan 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. optionSetChanged = function () {
  2. var optionsetControl = Xrm.Page.ui.controls.get("new_places");
  3. var options = optionsetControl.getAttribute().getOptions();
  4.  
  5. var value = Xrm.Page.getAttribute("new_location").getValue();
  6. // first option is selected
  7. if (value == 1) {
  8. optionsetControl.clearOptions();
  9. for (var i = 0; i < options.length - 1; i++) {
  10. if (i == 0 || i == 1) {
  11. optionsetControl.addOption(options[i]);
  12. }
  13. }
  14. }
  15. // else is second option is selected
  16. else if (value == 2) {
  17. optionsetControl.clearOptions();
  18. for (var i = 0; i < options.length - 1; i++) {
  19. if (i == 2 || i == 3 || i == 4) {
  20. optionsetControl.addOption(options[i]);
  21. }
  22.  
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment