Quantcast
Channel: Magnetism Solutions Dynamics CRM Blog : microsoft dynamics
Viewing all articles
Browse latest Browse all 651

setSubmitMode always not submitting for some users

$
0
0

While onsite at a client I received a support request that a user could not update certain values on an entity. These fields were read only fields that were set by JavaScript by changing the values of other fields. On create of a new record the user reported that the values would save successfully, however when editing the record the values would appear to change before changing back to the original once the form refreshed.

However in trying to reproduce this error myself using the System Administrator account this function worked successfully. Thinking this may be a security issue I logged into CRM using the affected users credentials on my machine and the error still did not occur.

Looking at the code I could see that is used the setSubmitMode JavaScript function to force CRM to save the values in the read only fields like:

Xrm.Page.getAttribute(fieldName).setSubmitMode("always");

However this was done in the onChange function that set the fields. I instead created a new function that ran onSave of the form that run the setSubmitMode function, this resolved the issue for the user and the JavaScript now behaved the same way for all users.

<p>functiononSave() {</p> <p>    Xrm.Page.getAttribute("fieldName").setSubmitMode("always");</p> <p>}</p>

setSubmitMode always not submitting for some users


Viewing all articles
Browse latest Browse all 651

Trending Articles



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