Microsoft Dynamics GP has the ability to output Sales Order Processing transactions to a printer so the documents can be sent via “snail” mail, or you can send the documents via email. You can even send documents both to email and the printer.
However, two issues have been found which make the functionality less than perfect. This sample project for GP Power Tools resolves these issues and restores the perfection.
The Sales Document Print Options window, which opens from the Sales Batch Entry window when the Print button is clicked, can only print documents, or send emails at one time. It cannot print documents and send emails as a single process.
When printing documents or sending emails, if there are too many transactions in the batch, GP has been reported to crash. I have heard that a batch containing more than 200 or 300 transactions can cause GP to crash. I suspect that the issue is that some of the printing/emailing process is handled in memory and if the Dynamics GP application runs out of a block of contiguous memory, it will generate an exception.
The final issue is related to usability. Every time the window is opened, users need to select the same options that they want over and over again.
Microsoft Dynamics GP has another window which can be used for the same functionality and also has more options. The Print Sales Documents window can print documents and send emails at the same time. It also allows ranges to be specified so you can specify the batch and limit the number of transactions that are printed to avoid the crashing problem.
The following GP Power Tools SOP_PRINT sample project intercepts the Print button on the Sales Batch Entry window to open and automate the Print Sales Document window. Before the automation code runs, it will ensure that the email is logged in (either Exchange Web Services or Exchange with Multi Factor Authentication). It will then ask if you want to automate printing, stay in manual mode or cancel.
When the window opens, it will change the default settings and if “Automate” has been selected, will print all Invoice and Return Documents in the batch in groups of 100 transactions.
Note: The number of transactions printed for each group is set in the SOP_PRINT_01 Parameter List. You can change it as desired but avoid going too large to stay clear of when Microsoft Dynamics GP becomes unstable.
Here is a quick summary of the components in the project:
Trigger to intercept the Sales Batch Entry Print button and replace the functionality with our custom code.
Trigger to Hide the Report Destination Dialog while the automation is active.
Trigger to restart the printing process after the reports are finished to print the next group of transactions.
Trigger to hide the Print Sales Document window while the automation is active.
Runtime Execute Script SOP_PRINT_01
Script to set the desired settings on the window including the Batch range and transaction number ranges and “click” the Print Button.
SQL Execute Script SOP_PRINT_01
SQL Query to get the starting and ending transaction numbers to be printed.
SQL Execute Script SOP_PRINT_02
SQL Query used to create a Batch Lookup for the Parameter List. (Used when testing).
Parameter List SOP_PRINT_01
Parameter List used for setting variables in scripts and storing values while the automation is running.
Downloading and Installing
Download the example code and import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):
The code will be active on next login or after switching companies, or you can use start the triggers manually from the Project Setup window.
For more information see:
- GP Power Tools Portal: http://winthropdc.com/GPPT
- GP Power Tools Samples: http://winthropdc.com/GPPT/Samples
- GP Power Tools Videos: http://winthropdc.com/GPPT/Videos
If you haven’t done so already, update to GP Power Tools Build 29 or later to get all the latest features and resolve the Security Vulnerability issue.
This article was originally posted on http://www.winthropdc.com/blog.