Following on from my previous posts: Customising the Company Login window series Part 1 - Introduction and Customising the Company Login window series Part 2 - Visual Basic for Applications, here is the method to create a solution using Dexterity.
As discussed in the earlier posts, the problem we are trying to overcome is that the company drop down list on the Company Login window is not wide enough to show a long company name. This can make it difficult to select the correct company when the company names are long and differ only by some characters at the end of the name.
Below is a screenshot of the original window from Microsoft Dynamics GP 2013.
Following are the step by step instructions on how to use Dexterity code to "modify" the window:
- Open a clean Dynamics.dic in your development environment. If you have not set up a development environment have a look at the Knowledge Base (KB) article I wrote on the topic:
How to set up the development environment when you use Dexterity in Microsoft Dynamics GP (KB 949622)
- Create a Workset to keep all the changes you have made grouped together. I called mine "Company Login".
- While in the workset, create the MBS_Switch_Company_PRE global procedure (using script below), then click Compile and Close. Creating the resource while you are in the workset automatically adds the script to the workset.
- Now create the Startup global procedure (using script below), then click Compile and Close. The global procedure Startup is a special script name which is executed when the Dexterity runtime starts and the dictionaries are first loaded. It runs before any other script and before any form is opened. Its purpose is to be used to register triggers on the desired events within Dynamics.
Note: you cannot access any SQL data from the Startup script as the client has not yet logged into SQL Server.
- From the menus select Debug >> Test (or press Ctrl-T) and login. You should now see that the Company Login window has been changed. Press Ctrl-T to return to the development mode.
- You can now create a chunk file of the customisation using the Product ID provided by Microsoft. For more information on creating chunk files and Product IDs see the KB articles I wrote below:
How to create a chunk file in Dexterity in Microsoft Dynamics GP (KB 894700)
Description of product IDs for Dexterity in Microsoft Dynamics GP (KB 914899)
- The resulting chunk file can now be deployed into live environment and included on next login.
Here is a screen shot of the window with the full 230 pixel adjustment:
Below is the code used:
Note: This code only reads the horizontal position and size once and then reuses those values for all fields, the vertical position and size is left unchanged by using the value of -1 in the move and resize commands.
Startup Global Procedure Code
The Dexterity source file of the scripts for this customisation are attached to the bottom of this article.
Hope you find this useful and educational.
07-Aug-2014: Updated Startup script to register trigger on FORM_PRE instead of WIN_PRE so that the shifting of the fields does not happen again when the restart form command is issued.