Dynamics 365 God Mode 2.0 for Unified Interface 2020 Wave 2

Paul Nieuwelaar, 04 November 2020

The God Mode bookmarklet I unleashed on the world back in 2014 has been one of the most useful Dynamics 365 bookmarklets to date. Over the years there’s been a few minor updates to keep it working with the latest releases of Dynamics 365 (since a lot of what it was doing was unsupported).

However, with the release of the 2020 Wave 2 update by Microsoft, there’s been enough change that I feel it’s worth posting an updated version, and a much simpler version without all the unsupported stuff.

For starters, the AddOnSave hack no longer seems to work (kudos to Microsoft). This used to undo a preventDefault caused by another save event, essentially allowing the form to save, and bypass validation. Since this doesn’t work, that whole part has been removed from the bookmarklet.

Next the setDisplayState("expanded") part has been removed from the tabs loop. This was mostly relevant to the classic UI anyway, however now in the unified interface it just sets focus to the tab instead. This is not ideal as you end up switching to the last tab on the form every time you click the bookmarklet. Most importantly however, with 2020 Wave 2 it seems that the other code setting fields to be enabled and non-mandatory seems to have issues when focusing another tab at the same time. This meant fields “appeared” to still be locked or required, even though they weren’t.

The new bookmarklet code is as follows, which is much smaller than before (and still allows you to edit inactive records!):

javascript:var form=Xrm.Page.data?window:$("iframe").filter(function(){return $(this).css( "visibility" )=="visible"})[0].contentWindow;form.Xrm.Page.data.entity.attributes.get().forEach(attr=>{attr.setRequiredLevel("none");attr.setSubmitMode("dirty");});form.Xrm.Page.ui.controls.get().forEach(ctrl=>{try{ctrl.setVisible(true);ctrl.setDisabled(false);ctrl.clearNotification();}catch(e){}});form.Xrm.Page.ui.tabs.get().forEach(tab=>{tab.setVisible(true);tab.sections.get().forEach(sect=>{sect.setVisible(true);});});

The first part does a little (kinda hacky) check to see if it’s the Unified Interface (i.e. Xrm Page is accessible), otherwise it uses the old method of selecting the visible tab for the Classic UI, just to keep support for both modes.

I’ve updated this bookmarklet, and will be updating most others on my Bookmarklets GitHub project, as they’re all a little out of date now with the Unified Interface changing things. In the meantime, most can be simply updated with the same form variable check as I’m doing on this one.