Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 13977

Tip #451: Locking field in business rule can be tricky

$
0
0

Business rule to lock a field Empowering users in Dynamics CRM is great but one needs to be prepared to troubleshoot adventures of a power user. If you have a rule that locks the field when certain conditions are met, beware what happens when this field is editable. That’s right, the last edit will be lost. Why? because locking the field is a common-speak for disabling the control and, as most of readers know, CRM cannot be stuffed to send saves the bandwidth by not sending content of the disabled controls.

Unfortunately, there is no definite answer to this challenge in “no code” land but the solution is fairly trivial – all we need to do is to force content submission for the control by wiring something like the following to the form OnSave event:

function account_onsave()
{
   if(Xrm.Page.getControl("emailaddress1")
              .getDisabled()) {
      Xrm.Page.getAttribute("emailaddress1")
              .setSubmitMode("always");
   }
}

Viewing all articles
Browse latest Browse all 13977

Trending Articles



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