Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Make All Read Only Fields Available

$
0
0

We've written jscript web resource to disable all fields but 2.  This is part of an approval process, and the jscript works.  Once the approver indicates approval with changes (selected from an option set), we tried to write another function to re-enable the fields, but the code is not doing anything.  I am not real familiar with controls.  Here are the scripts:

//MakeFieldsReadOnly, this works fine.
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);

      }
   }
}

//Make All Fields Available, nothing happens.

function ApprovalStatus_onchange()
{
var ApprovalStatus = Xrm.Page.getAttribute("synact_approvalstatus").getValue();
var controls = Xrm.Page.ui.controls.get();
for (var i in controls)
   {
      var control = controls[i];
if(!control.getDisabled() && (ApprovalStatus == 100000001 || ApprovalStatus == 100000002))
   {  
      control.setDisabled(false);
   }
}
}


Ken Compter


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>