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:
- CRM for tablets doesn't allow any functions that can block execution of scripts. Common JavaScript functions such as window.alert, window.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.
- 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.
-
The following methods do not work on CRM for tablets:
- 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,
}
else
{
// Code for web browser or CRM for Outlook only goes here.
}
// Code for any client goes here.
-
After identifying which ribbon buttons/commands do not work on CRM for tablets, a display rule should be configured using CommandClientTypeRule:
<DisplayRule
Id="My.HideOnModern">
<CommandClientTypeRule
Type="Modern"
InvertResult="true" />
</DisplayRule>
-
Debugging form scripts and ribbon commands on CRM for tablets can be challenging. Here are some helpful tips:
For more tips on working with the MoCa, visit PowerObjects blog. There are some great new enhancements in CRM 2015, including:
Happy CRM'ing!
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.
Thanks,
Florin