Microsoft Dynamics CRM 2015 – Upgrading from SOAP to REST JavaScript call

With Customers upgrading from CRM 2011 and older versions, Beringer has been tasked with providing infrastructural software upgrades to build on CRM as well as design the surrounding software extensions that interact with it.  A common CRM extension we offer is Javascript customizations, which interact with entity forms.  When upgrading CRM, there are some parts that need to be updated due to deprecated Javascript functions.  In particular I’d like to go over the SDK.REST Library and how it can be used to upgrade obsolete Javascript.


The SDK.REST Library easily replaces old CRM SOAP Calls.  These pieces of code were used to interact with the CRM API in order to get information that was not readily available on the Entity Form.  Here is a quick code sample:

The code above in essence is building out a request to gather data, in this case it is grabbing the current user.  In a previous blog article, I outlined some Javascript functions that are no longer in use.  You can see the GenerateAuthenticationHeader() is being used in the XML Request.  These SOAP Calls, along with that function are no longer defined for CRM 2013 or higher.

I’d also like to bring your attention to the ActiveXObject line.

ActiveXObject is a class exclusive to Internet Explorer.  Internet Explorer is soon to be thrown to the wayside for Microsoft’s new web browser Edge, so this is another reason this SOAP Call code should be upgraded, even if your CRM will not be upgraded.

SDK.REST Library

Now let’s look at a SDK.REST Call that does the same function

As you can see, the code is a lot cleaner.  You’ll see two functions inside of the SDK.REST Call.  The first one will operate on a Successful REST Call, the other will be called on an Error.  This is a much easier way of gathering information through Javascript since the SDK.REST Library contains all of the functions.  As long as your SDK.REST reference library is up-to-date in CRM, your Javascript code is also up to date.

Have any questions or need assistance with your CRM?  Please feel free to contact Beringer, a Microsoft Gold Certified Partner.