Archive | February, 2013

A simple javascript/AJAX function to post a SOAP request to CRM 2011

This is a simple function that I use to post a SOAP envelope to CRM 2011. Just pass the URL and the xml (you can create that with this function) and you should be good to go

    function soapToCRM(URL, data) {
        var returnValue
            type: "POST",
            contentType: "text/xml; charset=utf-8",
            datatype: "xml",
            async: false,
            url: URL,
            data: data,
            beforeSend: function (XMLHttpRequest) {
                XMLHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
                XMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
                XMLHttpRequest.setRequestHeader("SOAPAction", "");
            success: function (data, textStatus, XmlHttpRequest) {
                var NewCRMRecordCreated = data["d"];
                returnValue = true
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("failure " + errorThrown);
                returnValue = false;
        return returnValue;

Using AJAX and SOAP to create a CRM 2011 activity

I have posted a bunch of PowerShell scripts to interact with CRM 2011, now I am going to put up similar javascript versions. I feel that there is a lot of javascript content out there for CRM 2011, but most of it is javascript inside the actual CRM interface. I don’t see a lot of content about using javascript from a different webpage/site with ajax, so I thought I would post some of the code I put together.

This is a function that I put together to build a SOAP envelope for creating an activity in CRM 2011. Credit for the template goes to Jamie Miley and this post. I took his template a little further and created a function for either email,Phone call or appointment. In addition this function allows for multiple contacts in an phone call’s to and multiple required contacts in a meeting.

Continue Reading →

Powered by WordPress. Designed by WooThemes