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.


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
  // 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

About Frank Lee

Microsoft Dynamics 365 CRM/xRM consultant in San Francisco, USA.  Awarded the Microsoft MVP (Dynamics 365/CRM) 12 consecutive years from 2006 to 2018. Actively involved with Microsoft Dynamics CRM implementations since Microsoft CRM v1.0 beta (2002). Super passionate about everything CRM, especially in the areas of Cloud Computing, A.I., Digital Transformation and Automation.
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: Logo

You are commenting using your 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