Hello All,
Option set value is getting clear if we remove the specific option from it.
example: In Case form we have status reason field, on save of a case we are changing the status reason for the record. If the record's status reason say "Submitted" then we want to remove "Assigned" status reason from option set which we are doing via jscript but, it's clearing the current value of option set too.
var control = Xrm.Page.getControl("statuscode");
var status = Xrm.Page.data.entity.attributes.get("statuscode");
if (status.getValue() == '950000017') {
control.removeOption(950000021);
Xrm.Page.getControl("statuscode").setDisabled(true);
}
else {
control.removeOption(950000017);
Xrm.Page.getControl("statuscode").setDisabled(false);
}