1 - Prospect
2 - Proposal
3 - Negotiation
What i had to do is to filter the picklist so that only some of the options to be available, not all of them in the same time, ensuring that the user can't jump stages (jumping from 1 to 3), and that the user can't go backwards (from 2 to 1, from 3 to 2 or 1).
The code is:
// Get value of Pipeline Phase set by user if (Xrm.Page.getAttribute("new_salesstagecode").getSelectedOption() != null) {var val_salesstagecode = Xrm.Page.getAttribute("new_salesstagecode").getSelectedOption().value;} else {var val_salesstagecode = null;}
// Filter Pipeline Phase picklist to avoid users jumping stages if (val_salesstagecode == 1) { Xrm.Page.getControl("new_salesstagecode").removeOption(3); } else if (val_salesstagecode == 2) { Xrm.Page.getControl("new_salesstagecode").removeOption(1); } else if (val_salesstagecode == 3) { Xrm.Page.getControl("new_salesstagecode").removeOption(1); Xrm.Page.getControl("new_salesstagecode").removeOption(2); }
Thanks...
ReplyDelete