IE 11+ – Event.Mode Issues – Unsupported – Mode is null

Posted by dynamicsnick on June 18, 2015
Microsoft Dynamics CRM / Comments Off on IE 11+ – Event.Mode Issues – Unsupported – Mode is null

If you still happen to be using the event.mode option on your forms in CRM it is now officially deprecated with the latest release of IE11. You will receive a strange and mysterious error that looks states that Mode is null.

The resolution is to use the supported CrmContext.getEventArgs().getSaveMode() instead of event.mode in our JS libraries or page code

and here is how it might look in a simple code example for the onsave event for the account object: If a user attempts to deactivate an account.

function HandleOnSaveAccount(CRMContext) {

if (CRMContext.getEventArgs().getSaveMode() == 5)


alert(“You should not deactivate this account. Please contact the administrator first.”);



For this to work there are 2 things that need to happen in your event handler. You need to define a name for the CRM context object in this case it is called CRMContext, but it can be named anything. The other is that on the entity in CRM you must specify on the save event to pass the “context as first parameter” option and this will populate the function with the session context that you can use the context in your JS code.


This solution is compatible with IE 11 +  and older browsers as well.


Tags: ,