We written code (below) to disable all fields so they cannot be changed as part of an approval process. The code changes all the fields to disabled, but when you save/close the record and reopen, all the fields are editable. Since there are 50+ fields, is there a way to save all the fields to the database?
//MakeFieldsReadOnly,
function AllReadOnly_onchange()
{
var RequestApproval = Xrm.Page.getAttribute("synact_requestapproval");
var ApprovalStatus = Xrm.Page.ui.controls.get("synact_approvalstatus");
var ApprovalDate = Xrm.Page.ui.controls.get("synact_approvaldate");
var controls = Xrm.Page.ui.controls.get();
for (var i in controls)
{
var control = controls[i];
if (!control.getDisabled() && RequestApproval.getValue() == 1)
{
control.setDisabled(true);
ApprovalStatus.setDisabled(false);
ApprovalDate.setDisabled(false);
}
}
}
Ken Compter