Global Functions/Variables available in Dynamics CRM

By | October 19, 2009

Global Functions:

There are various global functions which provide information about the client system.

IsOnline: This will return if the form has been opened from an Online or Offline system. This could be helpful if you would want a particular feature to be made available in a specific mode only.


if (IsOnline())


alert(“You are working online”);


These above are available through scripting. If you would like to check this in your server side app, you need to add reference to the Microsoft.Crm.Outlook.Sdk assembly. The assembly contains a class named CrmOutlookService that can be used to check the status of the Outlook client.

IsCrmClientLoaded: This will return if the Microsoft Dynamics CRM for Outlook client has been loaded by Microsoft Outlook

IsCrmClientOffline: This will return true if Microsoft Dynamics CRM for Outlook with offline Access is currently in offline mode


When you call webservice through scripting, you need to pass the authentication information along with the SOAP header. This function returns the appropriate Microsoft Dynamics CRM authentication header based on each deployment type: on-premise, Internet-facing deployment (IFD), or Microsoft Dynamics CRM Online.


var soapBody = ““+


“ “;

var soapXml = “

“xmlns:soap=’’ “+

“xmlns:xsi=’’ “+


soapXml += GenerateAuthenticationHeader();

soapXml += soapBody;

soapXml += “

PrependOrgName: The CRM URL by default adds the CRM Organization name when you browse CRM. It is important that if you are displaying a custom page in an IFRAME, the path to the page should also include the current Organization name. This function automatically determines the current organization name and adds it to generate the URL specific to the current organization.


var url = prependOrgName(“/isv/app/myapp.aspx”);

results: If you were logged into Contoso organization “/Contoso/isv/app/myapp.aspx”

Global Variables:

Some of the Global variables that can really come in handy are

1. SERVER_URL: This will return the base Server URL.

2. ORG_UNIQUE_NAME: This will return the unique text value of the organizations name. This is the same value to you also receive in custom forms if you set the PassParams to be true.

:request 2007 crm>

Leave a Reply

Your email address will not be published. Required fields are marked *