Microsoft Dynamics CRM

{Quick Tip}Identify Device type in your client side scripts in CRM 2015 Update 1

Sometimes we need to make client side scripting is CRM intelligent enough to identify which device is running

and then only run some script and not others.

clip_image001

This method was introduced with Microsoft Dynamics CRM Online 2015 Update 1

context.client.getFormFactor()

The values work as below:

Value Form factor

0 Unknown

1 Desktop

2 Tablet

3 Phone

For eg, if there is a code particular to Desktop:

function fun()

{

var formFactor = Xrm.Page.context.client.getFormFactor();

if (formFactor == 1)

{

//Code specific to run on desktop

}
}

Hope it helps and Happy CRMing!

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s