Dynamics 365 Form Editor Button Opens a Different Form

Jordan Hohepa, 26 July 2017

Recently one of our clients had a situation where the Form Editor button would only open the main form. The client had just updated to Dynamics 365 and had stated that this issue had never happened with their previous version of CRM. While investigating this issue, I found that this was OOTB behavior with Dynamics 365. For comparison, the form editor button on all the previous versions of CRM would open the form the user was currently on, instead of always opening the main form. The screenshot below shows the unintended form opening when the form editor button is pressed in Dynamics 365.

clip_image002

Our solution for this is to create a form editor button to imitate the previous button functionality. Internally we use a bookmarklet button which can be added to your browser for easy access on any record. The code for the new form editor button is shown below:

javascript: var frame = $("iframe").filter(function () { return ($(this).css('visibility') == 'visible') }); var form = frame[0].contentWindow;var etc = null;try {etc = form.Xrm.Page.context.getQueryStringParameters().etc;} catch (e) { }if (etc == null || etc == 4200) {var entity = prompt("Type the entity name", "account");if (entity != null) {etc = form.Xrm.Internal.getEntityCode(entity);if (etc == null || etc == -1) {alert("Entity '" + entity + "' does not exist");}}}if (etc != null && etc != -1 && etc != 4200) {var formId = null;try {formId = form.Xrm.Page.ui.formSelector.getCurrentItem().getId();} catch (e) { }form.Mscrm.FormEditor.OpenFormEditor(etc, "main", formId);}void(0);

The following steps can be used to add the form editor bookmarklet to Internet Explorer. Other browsers should be able to use this bookmarklet button following the same steps:

Step 1: Open Internet Explorer, click the “Add to favourites bar” button in the space underneath the URL, for other browsers you may need to do something like right clicking this space and selecting “Add Page” from the dropdown menu.

Step 2: Enter a name for the bookmarklet (E.g. Form Editor) and copy the URL above into the ‘URL’ textbox.

image

Step 3: Now that the Form Editor Bookmarklet button has been created, navigate to the entity and form you wish to edit and click the Form Editor Bookmarklet.

Step 4: The correct form editor should open the intended form as shown in the screenshot below.

clip_image002[4]