Wednesday 15 February 2012

dynamics crm - Make AJAX request from MS CRM events -


I have an AJAX request to a script Onvev event of a form in MS CRM Dynamics 4.0. Now I have the code

  var http_request; //xmlHttpObject ready and send the request. Try {http_request = New ActiveXObject ("Msxm12.XMLHTTP"); } Hold (e) {try {http_request = new ActiveXObject ("Microsoft.XMLHTTP"); } Hold (e) {warning ("something went wrong .."); }} Var poststr = "foo = bar"; Http_request.open ("POST", "/folder/index.html", Incorrect); Http_request.setRequestHeader ("content-type", "text / xml; charset = UTF-8"); Http_request.send (poststr); // capture results var resultXml = http_request.responseText; Warning (resultXml);  

The alert now gives me the content of a 404-type error, I'm sure that is the page, it is available through the browser. If I change the http_request.open ("post", "/folder/index.html", incorrect);

http_request.open ("post", "localhost: 5555 / folder / index.html", false);
Fails () fails, "Permission denied"

update (7th December 2009);

I have created a virtual directory in the ISV folder of the CRM and have to raise an asp.net application. Now, if I go to crm.url.nlitter555/ISV/Default.aspx I;

'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version = 4.0. 0.0, Culture = neutral, Sarwajnikki token = 31bf3856ad364e35 'does not exist Parameter name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35

with stacketres;

  [ArgumentException: 'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' does not exist. Parameter Name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, version = 4.0.0.0, culture = neutral, PublicKeyToken = 31bf3856ad364e35] Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateType (string type name, type essential BaseType ) + 265 Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateProvider (String type name, IDictionary`2 configuration) +28 Microsoft.Crm.Authentication.AuthenticationPipelineSettings.LoadPipeline () +262 Microsoft.Crm.Authentication.AuthenticationPipelineSettings.get_AuthenticationProvider () +16 Microsoft .CRM. Authentication Authentication Engine.Execute (Object Sender, EventArgues E) +524 System Web. Synchronize Execution Steps. System. Web. Hpapackification. IECC actionstep. Exit (+68 system) Web. Acteepiapikkrn.aksakyutstep (IExecutionStep step, Boolean and Sinkronsn full) + 75  

Does anyone have any ideas? .NET application only writes a word of response, not because there is something special ...

Okay, I found out what the idea is that you want to call an AJAX call from CRM 4.0 to a dynamic .NET application, here's what you do.

Put the assemblies of your net application in the CRMWeb / bin folder in the CRM folder. Put the ASPX files into the folder in the ISV folder, I used the stunnware.com folder because it was there, but you might want to create another folder for dexterity after that, on-the-go (or in any on-event) Put something like this;

  var xmlHttp = null; XmlHttp = New ActiveXObject ("Microsoft.XMLHTTP"); Var getstr = "foo = bar and foo2 = bar 2"; Var url = prependOrgName ("/ ISV / * YOURFOLDER * / Default.aspx?" + Getstr); XmlHttp.open ("GET", URL, true); XmlHttp.send (zero);  

Of course, if you want to do anything with the reaction of the CRM XML-Request, you can use onreadystatechange for it.

Hope this can help other people. It may seem straightforward, but I found out how to do this (although I knew how to use AJAX and .NET and accessories). I think it's a shame that CRM developers are left in the cold by Microsoft. They should be put in the SDK document for some time and how to do it.


No comments:

Post a Comment