You are currently browsing the category archive for the ‘JavaScript’ category.

I stumbled across this URL in the MS CRM Development forum. It has great examples to help any newbie and a good reference point for dab hands.

http://msdn.microsoft.com/en-us/library/cc150864.aspx

Advertisements

It is fairly easy to launch an external application from within MS CRM and pass parameters, But sometimes you might need to do it the other way.

I recently had to pass a parameter to an MS CRM form from an external application. I found a way in which you can enable MS CRM 4.0 URL Query string Parameter by making a change to your registry setting on the blog below.

http://blogs.msdn.com/rextang/archive/2008/09/24/8962549.aspx

Once you’ve passed a parameter to your MS CRM form the next step would be to parse the URL to get the parameter. I wrote the code below to get the parameter. I’ve posted it on my blog because others might find it useful.

var varParameter = GetQueryString(“parameterNAME”);

if(varParameter != null)
{
if (varParameter.length > 0)
{
//DO SOME THING HERE.
}
}

function GetQueryString(paramName)
{
queryString = window.location.search.substring(1);
params = queryString.split(“&”);
for (i=0;i

 

Its quite often that you would want your code to only execute in a certain type of MS CRM Client. e.g. Outlook Laptop client, Outlook Workstation client.

Microsoft Dynamics CRM supports these clients:

– Microsoft Dynamics CRM Web application
– Microsoft Dynamics CRM for Outlook
– Microsoft Dynamics CRM for Outlook with Offline Access

You can check which client your form is being viewed in using JavaScript and the MS CRM Global Functions.

Function name Description
IsOnline Returns true if the form is online.
IsOutlookClient Returns true if the form is on either of the Outlook clients.
IsOutlookLaptopClient Returns true if the form is on the Outlook laptop client.
IsOutlookWorkstationClient Returns true if the form is on the Outlook desktop client.

An example of how you would use the functions is shown below.


if (IsOnline())
{
        alert("Form IsOnline!");
}

The example below demonstrates how to hide a field on an MS CRM form. 
The _c and _d are used to hide the label and the field.

/* Hide a form field */
crmForm.all.ownerid_c.style.visibility = 'hidden';
crmForm.all.ownerid_d.style.visibility = 'hidden';

OR

/* Hide a form field */
crmForm.all.ownerid.style.display ="none";