Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

HCLTech Microsoft Business Applications Practice Blog

for Dynamics 365, Power Platform and the rest of the Microsoft technology stack

Key Considerations for Writing Scripts for Dynamics CRM for Tablets Application

Post Author: HCLTech |

Microsoft Dynamics CRM for Tablets (aka MoCa) uses the same form definitions that are used in the web application. Any JavaScript code added to form event handlers or ribbon commands in the web application may also run within CRM for tablets application. However, due to presentation differences on the tablet form factor, there are some important limitations to be aware of: 

  1. CRM for tablets doesn't allow any functions that can block execution of scripts. Common JavaScript functions such as window.alertwindow.confirm, and window.prompt should be replaced by using the Xrm.UtilityalertDialog and confirmDialog functions. If you use window.alert in any form scripts, the message will automatically be displayed using Xrm.Utility.alertDialog without a callback function specified, but this is temporary and is considered deprecated. You must rewrite any code using window.alert to use Xrm.Utility.alertDialog instead.

  2. A common JavaScript function that does not work on CRM for tablets is window.open. This function is used to navigate the app to a specified location such as an External URL or a specific CRM page. A workaround for this limitation is available only if the script needs to launch a CRM entity form (new or existing record). You must rewrite the script to use Xrm.UtilityOpenEntityForm.

  3. The following methods do not work on CRM for tablets:


Xrm.Page.context. getCurrentTheme

Xrm.Page.ui ViewPort Methods

Xrm.Page.data.entity. getDataXml

Xrm.Page.ui control Web resource and IFRAME control methods

Xrm.Page.ui. formSelector object methods

Xrm.Page.ui tab. setDisplayState

Xrm.Page.ui. navigation.items collection

Xrm.Utility. openWebResource

Xrm.Page.ui. refreshRibbon



  •   Lookup control methods such as addCustomView, getDefaultView and setDefaultView for setting/getting default views of lookups do not work on CRM for tablets due to UI differences.
  •  jQuery does not work on CRM for tablets.
  • After identifying which scripts do not work on CRM for tablets, it is recommended to separate logic based on client type by using the getClient method:

var isCrmForTablets = (Xrm.Page.context.client.getClient() == "Mobile")

if (isCrmForTablets)


// Code for CRM for tablets only goes here,




// Code for web browser or CRM for Outlook only goes here.


// Code for any client goes here.


  1. After identifying which ribbon buttons/commands do not work on CRM for tablets, a display rule should be configured using CommandClientTypeRule:

    							InvertResult="true" />


  2. Debugging form scripts and ribbon commands on CRM for tablets can be challenging. Here are some helpful tips:
    • Install CRM for tablets on a computer with Windows 8 /8.1 and Microsoft Visual Studio installed. Include debugger statements in the script in order to launch the debugger using Visual Studio.
    • Replacing "orgname" with the CRM organization name.
    • Use Xrm.Utility.alertDialog to display values from your code within CRM for tablets.
    • The web browser can be used to leverage standard script debugging capabilities for the HTML 5 portion of CRM for tablets.
    • Login with CRM credentials into the following URL: https://orgname.crm.dynamics.com/nga/main.htm?org=orgname&server=https://orgname.crm.dynamics.com

    For more tips on working with the MoCa, visit PowerObjects blog. There are some great new enhancements in CRM 2015, including:

Happy CRM'ing!

By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

Leave a Reply

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

One comment on “Key Considerations for Writing Scripts for Dynamics CRM for Tablets Application”

  1. Hello,

    Can you start, using Xrm.Utility, a dialog on the tablet app?
    I am referring to the dialog process; I saw that they are not supported, but I saw on a forum someone hinting on that solution.


PowerObjects Recommends