I use JavaScript to set required level of field based on some selections, the field appears as optional but the form doesn't able to save and says please fill this field.
My code
Xrm.Page.ui.controls.get("new_field").setRequiredLevel("none");
I don't know why this happen i tried to hide the field using this code
Xrm.Page.ui.controls.get("new_field").setVisible(false);
it hides the field but when i press save the field appears again like a charm and cannot save the form.
I use JavaScript to set required level of field based on some selections, the field appears as optional but the form doesn't able to save and says please fill this field.
My code
Xrm.Page.ui.controls.get("new_field").setRequiredLevel("none");
I don't know why this happen i tried to hide the field using this code
Xrm.Page.ui.controls.get("new_field").setVisible(false);
it hides the field but when i press save the field appears again like a charm and cannot save the form.
The script doesnt look quite right,
setRequiredLevel
Xrm.Page.getAttribute("new_field").setRequiredLevel("none");
Visible
Xrm.Page.getControl("new_field").setVisible(false);