I am trying to write JS code to save the record based on a specific value. The purpose is to save the record before it is submitted in order for the sub-grid to be accessible. In other words, I do not want to depend on user to manually save the record in order for them to provide more information in the sub-grid. I figure if I force a save, then the sub-grid would be available prior to actually submitting the record.
Here is what I have so far. I am just learning JS which would explain my issue of applying the correct syntax. I have not incorporated any error handling at this point. When this code runs, I get an error message that the web resource does not exist. I have applied the event on the field.
var eCIR = (function ()
{
var saveOnFieldChange = function(execContext)
{
if (Xrm.Page.getAttribute("cir_closecontactacknowledgement").getValue() == 100000000)
{
Xrm.Page.data.save();
}
};
return
{
saveOnFieldChange : saveOnFieldChange
}
})();