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"); } }
There is a no code way to save the value. Place the same control in a form one more time and set visible by default to false. This way even though one control is locked other control is not visible and read-write that will force system to save the value.
Thank you for the suggestion! I guess you base your comment on the workaround floating around that is supposed to solve the problem. The issue is that, when you’re locking control in a business rule, the rule refers to the attribute and not the specific control. To me that indicates that both controls will be locked, as they are linked to the same attribute. I’ve tried this workaround on CRM 2013 and it didn’t work. I’m yet to try it on CRM 2015 but I’m curious if you actually tried it and whether it worked for you?