There was recently a question in the GP Community forums where the user wanted a way to stop cash receipts for a customer on hold because of some legal requirements. MVP Leslie Vail pointed out that she had used a VBA customization to handle this. As another alternative, you can do this very easily using the Trigger feature of Support Debugging tool.
Using the Support Debugging Tool we can easily display a warning message if user selects the customer that has been put on hold while entering the Cash Receipt. This can be achieved by defining Dexterity Triggers in scripting section of the Support Debugging Tool Setup window as explained below.
There was a detailed post on using triggers earlier – Dynamics GP SDT Essential Series 3 – Using Triggers (GP on Steroids)
Note – The emphasis here is to give an example of the trigger feature in SDT, more than anything else.
For instance, here is a Customer that has been put on Hold.
While entering the Cash Receipts if a user tries to select the Customer ID for the Customer on Hold, a warning message is displayed.
The Dexterity script also disables the Amount Text field on the Cash Receipts Entry window.
The code
The support debugging tool makes writing this code very easy.
IT-
- Generates the basic code for in and out parameters
- Generates the code for Window Open and empty fields based on events selected
- You can lookup the tables and field names using
For example – See below how the following line can be generated by just selecting the relevant field using a lookup!
Here’s the associated code for the use case defined above.
in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
local boolean l_Hold;
OUT_Condition = false;
if isopen(form RM_Cash_Receipts) then
if not empty(‘Customer Number’ of window RM_Cash_Receipts of form RM_Cash_Receipts) then
OUT_Condition = true;
get table RM_Customer_MSTR;
while err() <> EOF and empty(l_Hold)
do
if (‘Customer Number’ of window RM_Cash_Receipts of form RM_Cash_Receipts=‘Customer Number’ of table RM_Customer_MSTR) then
set l_Hold to ‘Hold’ of table RM_Customer_MSTR;
end if;
get next table RM_Customer_MSTR;
end while;
if not empty(l_Hold) then
warning “Customer is on hold”;
disable field ‘Originating Original Trx Amount’ of window ‘RM_Cash_Receipts’ of form ‘RM_Cash_Receipts’ ;
disable field ‘Original Trx Amount’ of window ‘RM_Cash_Receipts’ of form ‘RM_Cash_Receipts’;
else
enable field ‘Originating Original Trx Amount’ of window ‘RM_Cash_Receipts’ of form ‘RM_Cash_Receipts’ ;
enable field ‘Original Trx Amount’ of window ‘RM_Cash_Receipts’ of form ‘RM_Cash_Receipts’;
end if;
end if;
end if;
Alternatively – Just download and import the Code
You can simple download this code and test this example. The following settings file contains the code shown below. Rename the extension from txt to xml before importing. Download the settings file that contains the code here.
Select Configuration Export/Import from options menu on Support Debugging Tool window.
Options >> Configuration Export/Import
Click on the Import button to import the Script from the location specified as below.
Click OK on the Import Settings File window that contains the File ID defined for the Trigger to be imported.
Following screen shows the imported Trigger to prohibit the user from receiving cash from the Customers on Hold.
Click on the Automatic Debugger Mode link to open the Automatic Debugger Status window that contains the currently registered Triggers.
[...] Rubal uses the Support Debugging tool to come up with a prototype to answer a question at the Dynamics Community Forums – Stop cash receipts for a customer on hold. [...]
Great answer!
[...] Why would anyone want to do that? One word, lawsuit. Check out Rubal’s post on GP Window titled Stop cash receipts for a customer on hold – Dynamics GP SDT Essential Series 4. Published: Friday, September 10, 2010, 03:21 [...]
[...] Stop cash receipts for a customer on hold – Dynamics GP SDT Essential Series 4 [...]