JavaScript to Set IFRAME in Microsoft CRM 2013 and CRM for Tablets


One of my clients asked to embed an IFrame in a CRM Account Form with a URL containing a specific Query String value from one of the Account record fields.  This is a pretty straight forward JavaScript. 

The CRM JavaScript to leveage is:  Xrm.Page.ui.controls.get(“IFRAME_[Insert Name]”).setSrc([Insert URL]);

However, the challenge with CRM 2013 or CRM Online is that CRM for Tablets doesn’t support IFrame at this time and therefore the above JavaScript will produce an error when opening an Account record on CRM for Tablets.  Here is the link for details on what code can run in CRM for Tablets.

image

There was an error with this field’s customized event…Unable to get property “setScr” of undefined or null reference

The approach would be to check for CRM for Tablets and if it is, don’t run the IFrame portion of the JavaScript code.  Here is an example from Write and debug scripts for CRM for tablets:

var isCrmForTablets = (Xrm.Page.context.client.getClient() == “Mobile”);
if (isCrmForTablets)
{
  // Code for CRM for Tablets only goes here
}
else
{
  // Code for web browser or Outlook Client only goes here
}
// Code for any Client goes here

 

 

Contact me if you are looking for help with your CRM Online.

Frank Lee, Microsoft CRM MVP since 2006
Workopia, Inc. – Dynamics CRM Online Specialist, San Francisco

Advertisements

About Microsoft Dynamics CRM Online

Microsoft Dynamics CRM and CRM Online specialist. Microsoft CRM MVP since 2006
This entry was posted in CRM 2013, CRM On Premise, CRM Online, JavaScript, Microsoft CRM, Microsoft Dynamics CRM, Mobile, MS CRM, Outlook Client, Software Development Kit (SDK), Tablet and tagged , , , , . Bookmark the permalink.

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