Search This Blog

Monday, February 7, 2011

Call ASPX page from MS CRM 4.0 using Javascript OnSave Event


Copy and paste the following code in OnSave event of Form in MS CRM entity

var APP_URL = "http://www.yourapplicationurl.com";
GetXMLResponse(APP_URL);

function GetXMLResponse(APP_URL)

{
try
{
xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
xmlHttp.open('POST', APP_URL + '/Validations.aspx?oId=' + crmForm.ObjectId + '&oType=DOC' , false);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4)
{
myXmlDoc = xmlHttp.responseXML;
}
}

xmlHttp.send();

}
catch(e)
{
alert('Error in load...' + e);
}
return;
}

No comments:

Post a Comment