Recently we have upgraded our client environment to CRM 2015 and our first observation after upgrade was that none of SDK calls through the custom javascript methods was working. After debugging, we found that there was some common function to get the server url and it was getting it through Xrm.Page.context.getServerUrl().
Although getServerUrl() was already deprecated in CRM 2013 but still it used to work when upgraded from CRM 2011 to 2013. Now it seems to have been excluded from the API list only and hence you would get undefined error if your existing code is using the same. Please check for the list of method it is showing up in the chrome debugger in the Xrm.Page.context namespace, in the below screenshot. You would find that the getServerUrl() method is missing.
changing the code to use Xrm.Page.context.getClientUrl() would work.
Hope this helps!
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.
Thanks mate!!
Thanks for reading my blog post
Thanx…working perfect
Is there a chance for Xrm.Page.context.getClientUrl() to return null or undefined???
Here is the code i am trying to update:
if (typeof(Xrm.Page.context.getClientUrl) != “undefined”)
return Xrm.Page.context.getClientUrl();
else
return Xrm.Page.context.getServerUrl();
Can anyone help me?
Thanks in advance!!!!
Hi Neo,
Please let me know where are you trying to access the client URL i,e from form or webresource or any other stuff?