In CRM 2013 Microsoft has introduced this new client context method called “getClientUrl”
This is the replacement to the previous method called “getServerUrl” that was present in CRM 2011.
This method was faulty because it always returns the server name in the URL as it is set up in the CRM deployment manager, irrespective of how the host url looks like.
this is issue in scenarios where users might have invoked CRM using the server IP address or fully qualified domain name etc.
because when in the java script we call getServerUrl it does not return the URL with the server name as it was used by the calling the host url, but that of what is stored in the server, which fails , in the situations where the server name is not accessible from the host machine but the IP or fully qualified name.
in order to correct this fault in the getServerUrl() method call, Microsoft has introduced this getClientUrl() ,which takes care of the Host URL through which CRM is invoked and return the OData Url accordingly.
Please note getServerUrl() is now deprecated.
the details found in SDK is as below..
Returns the base URL that was used to access the application.
Use this instead of the deprecated getServerUrl method.
The values returned will resemble those listed in the following table.
|Microsoft Dynamics CRM (on-premises)||http(s)://server/org|
|Microsoft Dynamics CRM Online||https://org.crm.dynamics.com|
|Microsoft Dynamics CRM for Outlook with Offline Access when offline||http://localhost:2525|