Wednesday, April 25, 2012

How to force CRM Save after javascript update on form

If you made an update of the form on a disabled field in CRM 2011, after the Save button was pushed you realized that the information wasn't saved.


What you have to do is to set the field as "dirty",  so that CRM knows the field value has changed and should be submitted in the update of the record.  Meaning that you have to add also a javascript code so that change will be taken into the save of the form.


In CRM 4.0 this was done by:
crmForm.all.[fieldname].ForceSubmit = true;

In CRM 2011 this is done by:
Xrm.Page.getAttribute("new_field").setSubmitMode("always");

This should force CRM to include the field when updating the record instead of ignoring the update.

No comments:

Post a Comment