I have this piece of code that was working fine on CRM 2011 roll up 3 and now is not closing the window anymore after roll up 13.
Before it would process just fine and close the Incident call window when I click complete call
now, it refreshes the window and save. it does update after a few seconds, but why is it not closing the window anymore
is it possible to have
Xrm.Page.data.entity.save()
Xrm.Page.ui.close()
with some ignore if is dirty and save without the pop up?
function ResolveCall()
{
var msgResponse = confirm("Are you sure you want to COMPLETE this call?");
if (msgResponse)
{
if (!editData("Resolve")) {
return;
}
var updateCall = Xrm.Page.getAttribute("new_completeorcancel")
if (updateCall != null) {
Xrm.Page.getAttribute("new_completeorcancel").setValue('Complete');
Xrm.Page.getAttribute("new_completeorcancel").setSubmitMode('never');
Xrm.Page.getAttribute("statecode").setSubmitMode('never');
}
// showIsDirty();
var EntityId = Xrm.Page.data.entity.getId();
var WorkflowId = "633F7AFF-6A7F-4369-976E-2C9YY72ED07D"
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
Xrm.Page.context.getAuthenticationHeader() +
"<soap:Body>" +
"<Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"<Request xsi:type=\"ExecuteWorkflowRequest\">" +
"<EntityId>" + EntityId + "</EntityId>" +
"<WorkflowId>" + WorkflowId + "</WorkflowId>" + "</Request>" +
"</Execute>" +
"</soap:Body>" +
"</soap:Envelope>";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
Xrm.Page.data.entity.save("saveandclose");
}
}