Defaulting "Include Totals and Deposits" in Sales Transfer Entry with the Support Debugging Tool

More times than I care to count I have been called in to fix records left behind because the Include Totals and Deposits option was not marked when transferring a sales document from an existing order to an invoice. The problem is, it is so easy to forget to mark that box if you are doing this for hundreds of transactions fractured in multiple batches, especially at the end of the week when invoices need to be submitted to customers, prior to the FedEx truck arriving at 4:00 PM.

Sales Transfer Documents window

While this "fix" has been provided as a Modifier with VBA project before, I thought, why not really prop this up a bit with a Support Debugging Tool non-logging trigger and take advantage of the Automatic Debugger Mode functionality? Well, I have done just that!

The first thing we need to do is setup the trigger itself. In this case, we want to select a Focus Event trigger that will fire exactly on a field change condition. The field in question is the '(L) Order To Invoice CB' checkbox field. You can use the lookup button next to the Form Name field on the Resource tab to open the Support Debugging Tool's Resource Explorer window and locate the field and select it.


Trigger Setup
Since this will be a non-logging trigger, we will want to check the Do not activate Logging Mode option on the window. And to make sure the trigger always starts up with Microsoft Dynamics GP, we will want to check the Start Trigger Automatically on Login option as well.

Second, we can choose to have the Support Debugging Tool perform certain actions when the event fires - the event being when the checkbox is marked. If you happen to be running build 15 of the SDT, you can have a message display as a desktop alert on the lower right corner of your screen, similar to when you receive a Microsoft Outlook message.



For the purpose of this trigger, we will not take any actions when the trigger fires.

Third, we must add the processing script. The Support Debugging Tool does a really good job at providing a helper to build upon. So all we need to do is add the little bit to process the Include Totals and Deposits checkbox field, after the Transfer to Invoice checkbox has been marked. This is the final script:

Trigger processing script

Finally, since this is a non-logging trigger, the Options tab will show all logging options disabled. However, you can still choose a date range for this trigger to take effect.

Options tab
Since the goal is to have this trigger available at all times, there's no need to add a start and end date. It's now time to save the trigger and enable it.


We can choose to turn on our Non Logging Automatic Start Only triggers. Since our SOP_XFER trigger has been marked as a non-logging automatic trigger we should be able to see it in the Automatic Debugger Mode Status window.
Automatic Debugger Mode Status window

This is really all there is to it! The trigger should now cause the Include Totals and Deposits checkbox to activate automatically when we choose the Orders to Invoices checkbox.

I have attached the configuration file to be imported with the Support Debugging Tool's Configuration Export/Import window. Once you import the XML file just activate your trigger as indicated above and you should be good to go. No more forgetting to mark Include Totals and Deposits when transferring orders to invoices.

Include Totals and Deposits trigger - SOP_XFER.zip


The Support Debugging Tool's non-logging triggers functionality is a very powerful way to deploy simple scripts that can take care of every day headaches. All you need is a bit of creativity and the tool itself - see David Musgrave's article Support Debugging Tool Build 15 released for more on the latest Support Debugging Tool build.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

Comments

Jivtesh Singh said…
Mariano - This is fantastic. Although I have tested using non-logging triggers in the past in test environment, I have not yet deployed this in the production environment. I don't think there should be a problem - but what are your views ? Have you started deploying solutions based on this in production ?

Jivtesh
Mariano Gomez said…
Jivtesh,
I tend to use the Support Debugging Tool to its fullest extent, so simple solutions like this get deployed very often. Also keep in mind that the code is not stored in a dictionary, but rather in the XML configuration file. This makes deploying code a very palatable proposition for companies looking to minimize their customizations footprint.

MG.-
Tim Gordon said…
Nice article Mariano! Very handy functionality
Utah said…
Love the tip. This was the first trigger I loaded into Support Debugging Tool. Should triggers be moved to another location eventually? If so, where? Or does SDT work as a permanent solution? I have built additional triggers and wonder if it causes a drag on resources, especially at startup, by leaving them in SDT versus another location.

Tom
Mariano Gomez said…
@Tom:
The only other location you can move them to is an actual Dexterity dictionary. No, they don't cause a drag on resources, not anymore than a dictionary would.

MG.-

Popular posts from this blog

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

Do I have to use those "Z-" currency IDs in GP?

Microsoft Dynamics GP Scrolling Windows and Line Sequence Numbers