In this webinar, our experts showcase a variety of demo use cases of how different components of the...
JavaScript comes in very handy when working within Microsoft Dynamics CRM, and we have a lot of blogs on using JavaScript in CRM.
Starting from CRM 2011 UR 12, the getServerUrl (which returns the base server URL) and the getAuthenticationHeader method that was available pre-UR12 when referencing the Xrm.Page.context have been deprecated. These two methods are no longer supported in CRM 2013. So if you are referencing the getServerUrl and you are on UR12, and you are upgrading to UR12 or CRM 2013, you need to change all your JavaScript code to use getClientUrl instead.
A good way to make the JavaScript Version agnostic would be to check if the getClientUrl exists before using it.
For example:
var url ; if(Xrm.Page.context.getClientUrl)//Post UR 12 { url = Xrm.Page.context.getClientUrl(); } else//Pre UR 12 { url = Xrm.Page.context.getServerUrl(); }
Take note that getClientUrl does not append the slash character ('/') at the end of the URL.
So if you are currently using any JavaScript similar to the snippet below…
var serviceUrl = url + "XRMServices/2011/OrganizationData.svc/";
….make sure you change it to:
var serviceUrl = url + "/XRMServices/2011/OrganizationData.svc/";
If this was helpful, you can also check out our other blogs and resources for Microsoft Dynamics CRM 2013.
Happy CRM'ing!
Xrm.Page.context.isOutlookOnline and isOutlookClient are also deprecated.
Hi,
I have written the JavaScript code for crm 2011, but after crm up-gradation to 2013, that code not working in crm 2013.
so i need to change below code:
document.getElementById("new_product").setAttribute("lookupstyle", "multi");
Can anyone help on this.
Thanks in advance
1)
What are the methods available from the context in ms crm plugins
?