Friday, August 21, 2009

Logging scripts in Dynamics GP

Ever wonder what Dynamics GP is really doing when you press a button on a form? Most Dynamics GP users are already familiar with the Dex SQL Log where you can see the SQL statements that get sent to the SQL Server. But Dynamics GP also offers the ability to log the scripts that are being processed within the Dexterity run-time environment. This article will show you how to use this powerful feature.

To use the 'Log Scripts' feature from Dynamics GP, you must turn on the Script Debugger in the Dex.ini file. You will find the Dex.ini in '\Program Files\Microsoft Dynamics\GP$..\Data' folder if you're using Dynamics GP 10 and in '\Program Files\Microsoft Dynamics\GP' folder if you're using previous versions. Edit the Dex.ini file using notepad. Add the statement 'ScriptDebugger=TRUE' if it doesn't already exist under the section header [General] as shown in the screen shot below.

dexini

When you're done, save the file and launch Dynamics GP. After you have logged into GP, you will notice a new menu item called 'Debug' either to the left or right of your regular menu items. You will notice a bunch of new menu items within Debug but for our purposes, we will only be concerned with 'Log Scripts'.

Now lets say you want to see what the Dexterity run-time is doing when you click 'Save' on the 'Customer Maintenance' window. You can first open the 'Customer Maintenance' window by going to Cards -> Sales -> Customer. Then add a new customer by just putting in the required fields (i.e. Customer ID and Name). Then, before clicking on 'Save', click on the 'Debug' menu and 'Log Scripts'. A dialog will appear asking you where to save a file 'Script.log'. Find a place to save the file and click the 'Save' button. Then click on the 'Save' button on the 'Customer Maintenance' form. Finally, when GP is done saving the customer card, go back to the 'Debug' menu and click on 'Log Scripts' again. This will turn off log scripting.

To see the output of the log, find the Script.log file in the path that you had originally specified. Then just open it with notepad. It should look something like this:

Scriptlog

To many people, this may be a bunch of non-sense. But, for a developer, this can be very useful. In particular, you can see what types of Dexterity global procedures are being called and at what point. With this information, you can create Dexterity triggers to add functionality at the right time. This is particularly useful when you're working with many dictionaries (i.e. a 3rd party dictionary).

In conclusion, the 'Script log' feature is a powerful feature that gives you a better understanding of what Dynamics GP is doing under the covers.

About the Author:

I’m Dan Sionov, founder of accountingBot. I’ve been developing software for Dynamics GP since 1995 and haven’t grown tired of it. We make eftEmailer, a flexible yet simple to use application for Dynamics GP that allows you to send e-mails to vendors receiving EFT direct deposits.

No comments:

Post a Comment