Quick tip to avoid redundant code to enable/disable/show/hide a field.
1. Hold the result of hide or disable condition in a variable.
Var isDisable =(formContext.getAttribute('accounttype').getValue()==1);
2. Use the result in disable rule so that it will flip between enable and disable without redundant script lines for enable/disable and avoids if branching
formContext.getControl("<Field Name>").setDisabled(isDisable);
Hi Ram, I think Xrm.page is now deprecated for UCI.
ReplyDeleteYour are correct and updated blog accordingly. Appreciate it!
ReplyDeletecheers...
Delete