My Photo

Microsoft Dynamics 365

Official Blog for Microsoft Dynamics Functional and Technical Solutions....
Browsing Category " using javascript in mscrm "

Method Xrm.Page.ui.formSelector does not work in tablet and mobile device. Use getClient() in Dynamics 365 , MS CRM

Below are some of the examples that will not work in tablets when using MSCRM

Xrm.Page.context. getCurrentThemeXrm.Page.ui ViewPort Methods getDataXmlXrm.Page.ui control Web resource and IFRAME control methods
Xrm.Page.ui. formSelector object methodsXrm.Page.ui tab. setDisplayState
Xrm.Page.ui. navigation.items collectionXrm.Utility. openWebResource
Xrm.Page.ui. refreshRibbon

When these method are executed in Tablet or mobile device then these will return nothing and defining will return undefined.
So  if we are customization it for tablet we should distinguish the client device in JS and write code .

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.
To make sure which commands will work in tablet then include a command rule for more info refer Here.

Hope it will help. thanks


Get Form Type And Save Modes using JavaScript in mscrm 2011 , mscrm 2013 , mscrm 2015

getSaveMode() : Its Return a value telling what was the save event of ms crm entity record ( like is it due to deactivation of form , manual save or save and close etc) below is the full list of events .

// Code

Event ModeValue
Save and Close2
Send (Email)7
Disqualify (Lead)15
Qualify (Lead)16
Assign (user or team owned entities)47
Save as Completed (Activities)58
Save and New59
getFormType() :  Its Return a value Telling about form type of ms crm entity record ( Update , or create etc) , below is the full list of events.