Dynamics GP SDT Essential Series 3 – Using Triggers (GP on Steroids)

A really awesome feature of Support Debugging Tool is the non-logging triggers features that watches for specified events and exception conditions.

To give a very simple example – you can define a Trigger for Customer Field Change Event on Cash Receipts Entry window. After you have done that, when there is a change in the Customer field – you can do anything – display a message, send an email or execute code.


David Musgrave has a nice introduction here – Using the Support Debugging Tool to create temporary fixes

Non-logging triggers have two purposes, they can be used when looking for the cause of issues to execute additional code to help with the debugging work, for example: reading data and storing it in the log for later analysis; or popping up a dialog to confirm a particular piece of code has been executed.

However, they can also be used to execute additional code that can be used to temporary fix an issue or quickly prototype code for a permanent fix. Once the temporary fix has been tested, it can be used while a more permanent solution is developed…”

Marian Verzosa explains how she used this feature to resolve an issue – Recurring Transactions and Record Notes

“…To resolve this issue, we created non logging triggers using the Support Debugging Tool’s Automatic Debugger Mode feature to capture when Receivables Management transactions are deleted from the Receivables Transaction Entry (RM_Sales_Entry) or the Receivables Batch Entry (RM_Batch_Entry) windows…”


Automatic Debugger mode is the Advanced Mode feature of Support Debugging Tool.

To enable Advanced Mode features of this tool, navigate to Dex.ini Settings window through Options->Dex.ini Settings and check “Enable Debugger Advanced Mode Features” option.

Support Debugging Tool >> Options >> Dex.ini

Open the Support Debugging Tool Setup window from Options menu.

Options >> Setup Automatic Debugger Mode


To monitor some specific events or exception conditions, Automatic Debugger Mode feature of Support Debugging Tool assists in defining triggers for those events/exception conditions. Following article shows how a trigger can be defined.

Trigger Header section
To uniquely identify the trigger, user can enter the Trigger ID  for the trigger being defined and Trigger Description for the Trigger.


For each Trigger ID, user can choose the type of trigger to be defined from Trigger Type dropdown.


For each trigger ID, an event must be selected which can be used to look for the exception condition.


Trigger Attach dropdown allows user to specify when the code for the Dexterity trigger is to be executed (Before Original, After Original) when the selected event for the chosen object occurs.


· Resource Selection Section:

This is where you can select a Window.

An appropriate Product Name can be chosen from the Product Name dropdown. For the selected product, a product ID is displayed in the ID field.

To make it easier for the user to select the required resource, the Resource lookup button can be clicked. Clicking on the lookup button, a Resource Explorer window opens that allows user to select a resource when Focus Event is chosen as the Trigger Type.


Similarly, clicking on the lookup button, Table Explorer window opens that allows user to select a resource when Table is chosen as the Trigger Type.


The technical name of the field on which to define the trigger can be entered in Field Name text field.


· Action Fields Section:

If user wishes to display a message as defined in the Dialog Message field when the condition defined in the Trigger is met, Display Message checkbox needs to be checked.
Also, user can check the Send Email checkbox to send an email with the log details of the trigger to the Administrator Email address as setup in the Administrator Settings window.

When the required Trigger Type, Trigger Event and Resource Information are chosen, a default script is automatically populated (awesome!) that has the required parameters including a Boolean OUT_Condition.


When trigger occurs, the dialog box with message specified in Dialog Message field on Support Debugging Setup window appears.


Other Options:

Clicking on the Insert button pops up options to insert Dexterity sanScript code constructs as shown below:


To insert a resource into the script, click on the Names button. When clicked, the Resource Explorer window will open from where the user can select a resource to be inserted into the script. For instance, if user wishes to insert a code for Batch Number – Batch Number can be chosen from the Resource Explorer as shown below.


Clicking OK on Resource Explorer inserts the resource in the code window below:


There are a number of Helper functions available for user to choose and insert into the code. Navigate to the Insert Helper Function window and select a Helper Function.


There are Script Formatting functions available in the Script menu to assist in finding, replacing, checking the syntax and color options of the text.


User can set the Date Range for the execution of Triggers. Click on the Options button to open the Support Debugging Tool Setup Options dialog wherein the user can set the Start Date and the End Date for the Trigger to stay active.


To have the Triggers set for selected or all the users and companies, click on the User button to open the Start Trigger Automatically on Login for Users window.


A number of options are available to set the Automatic Debugger Mode. That is, User can choose to:

Activate just the Default trigger ID.
Activate the logging trigger IDs marked to start automatically.
Activate all logging IDs in system except those marked as disabled.
Activate the non-logging trigger IDs marked to start automatically.
Activate all non-logging trigger IDs in the system (except those marked as disabled).



To view all the triggers currently registered by the Support Debugging Tool, clicking on the Automatic Debugger Mode hyperlink to open the Automatic Debugger Mode Status window.


Also, user can unregister the triggers by clicking on the Unregister button on Automatic Debugger Mode Status window.