I have an event registered onSave on form of a custom entity on a crm 2015 on premise organization, which seems to enter in a recursive call. After i hit save the event keeps call it self, until i kill IE through task manager or the IE crashes with memory stack full. I have checked and it doesn't seem to be related to what i have in the function, meaning i am not triggering in any way the on save event again.
Here is the function code:
function contract_OnSave(context) {
var eventArgs = context.getEventArgs();
if (eventArgs.getSaveMode() == 1) {
if (Xrm.Page.getAttribute("new_field").getValue() != null) {
var mort = Xrm.Page.getAttribute("new_field").getValue();
if (mort == true) {
Xrm.Utility.confirmDialog("Would you like to open a new window for a Case?",
saveFormOnOpenCase,
callback)
}
}
}
}
function saveFormOnOpenCase()
{
Xrm.Page.data.save();
var parameters = {};
parameters["new_subjectnew"] = 100000002;
// Open the window.
var windowOptions = {
openInNewWindow: true
};
Xrm.Utility.openEntityForm("incident", null, parameters, windowOptions);
}
function callback() {
}
It seemed to me like it is a bug in CRM 2015, after which i checked the version of the CRM, and noticed it is the RTM version. I suggested a CRM upgrade to Update 1 and it seemed as the most logical step to take. But even after the upgrade, the issue is still there.
I tried registering the same function on OnChange event on the field, and it was working fine, except the openInNewWindow option, of the openEntityForm function, which does not open a new window, but that is a different issue.
I am using IE 11.
Can someone please confirm if this is happening in another CRM 2015 environment as well, or if i am missing something?