getServerUrl is deprecated in CRM 2013

Hi,
 
We all know that getServerUrl is deprecated in CRM 2013. Even now, there are many customer who are using CRM 2011. So, while writing the JavaScript we should take some extra care for the code to work in the later versions.
 

var url = “”;

if (Xrm.Page.context.getClientUrl) {
   //Post UR 12
   url = Xrm.Page.context.getClientUrl();
}
else {
   //Pre UR 12
   url = Xrm.Page.context.getServerUrl();
}

Hope this helps
 

Happy CRM’ing
Gopinath.
 
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s