Duplicating a Microsoft Dexterity window on the same form - Part 1/2

Just today, I was trying to solve a problem that at first seemed very simple: I needed to duplicate a Microsoft Dexterity window on the same form.

Background

To provide some context, I have a Dexterity form which hosts a modal window that needs to be displayed in middle of a process - we will call this window, window B of form B. Form B implements an OpenWindow form script that serves as an API to any calling script. The OpenWindow scripts implements a parameter that allows the modal window to either wait for user input or continue processing automatically (that is, without user input), which in turn would close the modal window (and the form) upon completion of all processes executed by the OpenWindow script.

To make matters more interesting, one of the callers happen to be a script on another modal window in another form - we will call this window, window A of form A. Now, when this code (and process) is performed from the Microsoft Dynamics GP desktop client, everything occurs as expected: the field script on window A of form A executes its processes, then calls OpenWindow of form B (in background) and closes. OpenWindow of form B opens window B, executes its processes and closes form B.

When this code is executed under Microsoft Dynamics GP web client, form A with modal window A executes its processes, and although a call to OpenWindow of form B is performed, the modal window on form B never displays because the modal window A of form A never closes.

As it turns out, both the Silverlight (GP 2013/GP 2015) and HTML 5 (GP 2016 and above) web clients have a strict platform implementation for modal windows, this is, they can only be dismissed by user interaction, and not by code - the Dexterity close window button is also disabled for obvious reasons.

So what can a Dexterity developer do if they need to implement a code driven modal window for the web client? Well, you can turn to a mode-less window or a primary window, if needed.


So now the question becomes, how do you duplicate the window on the same form? There are a couple methods you can use to do this:

Method 1 - Dexterity Utilities

1. Create a copy of your development dictionary.



2. Launch the Dexterity IDE. Open the copy of the development dictionary and rename the desired window in the target form. Since I want my window type to be a Modeless Dialog, I change the name to reflect that by adding _ML at the end of the name, and update the actual Window Type property.



NOTE: Once you rename the window, you will want to update all field and window level event scripts to match the new window name.

3. Launch Dexterity Utilities. Open the copy development dictionary as your source and the primary development as your destination.



4. Click the Transfer button on the toolbar and select Window. Locate the renamed window on the desired form and click Transfer.


Enter the name for the transfer report. I strongly suggest you look at the report for any errors.


NOTE: You are *not* presented with a destination form. This is because Dexterity Utilities will transfer the window to a form of the same name in the destination dictionary.

Close Dexterity Utilities.

5. Launch Microsoft Dexterity IDE and open your primary development dictionary. Open the form and now you will see that the Modeless Dialog window is now a part of the form.


You can now compile the form (and the entire dictionary at some point) to ensure all your scripts compile properly and without any errors.

Final thoughts for this method:

1. Since all field event scripts on the window have the same code, consider moving the code in these fields to form level procedures and functions where appropriate. This will ensure any code fixes and expansion is done in one place.

2. I feel this method works well for windows with a very low amount of field scripts. If you have more complex windows to duplicate, then this method becomes a bit more involved, since renaming all field and window level event scripts could be a challenge.

3. This method works to duplicate any window of any window type on the same form.

Tomorrow, I will present a second method that may prove more effective to duplicate windows on the same form, especially for windows with a significant amount of field and window level scripts.

Until next post!

MG.-
Mariano Gomez, MVP

Comments

Popular posts from this blog

Power Apps - Application Monitoring with Azure Application Insights

DBMS: 12 Microsoft Dynamics GP: 0 error when updating to Microsoft Dynamics GP 2013 R2

eConnect Integration Service for Microsoft Dynamics GP 2010