By Steve Endow
In a recent blog post, I described a problem I was having with VS Tools in Dynamics GP. An event handler wasn’t working correctly when a VS Tools window triggered an action on a GP window.
The issue occurred in the GP 2013 Void Historical Payables Transactions window. When you click the “Mark All” button, two confirmation dialogs pop up, which are new in GP 2013. My goal was to bypass these dialogs.
Initially, I created an AddIn with an event handler for the “BeforeModalDialog” event. This functioned correctly when I clicked “Mark All” directly within GP. However, if my VS Tools window triggered the button click, the event handler wouldn’t execute.
After extensive testing, I suspected a bug and began exploring workarounds. I attempted various approaches that worked when used directly in GP but failed when triggered from the VS Tools window.
For example, I tried embedding VBA script within the window to manage the dialogs. Again, this was successful when clicking the button within GP, but not when initiated by VS Tools.
I even considered external tools like Continuum and macros but couldn’t find suitable solutions. Frustrated, I reached out to .NET and GP experts Andrew Dean and Tim Wappat for assistance. They confirmed the issue and offered suggestions, but nothing resolved the problem.
As a last resort, I resorted to using the Windows API to identify and interact with the dialog boxes directly. This method bypassed GP and VS Tools entirely. It was a workaround, but it worked.
The following day, Andrew created a VS Tools test application that successfully triggered the “BeforeModalDialog” event. Tim Wappat reviewed the code and discovered the root cause: Andrew had used a standard Windows Form instead of the VS Tools DexUIForm for his test window.
After modifying my code to inherit from the “Form” class instead of “DexUIForm”, the event handler functioned correctly.
public partial class FrmVoidTest : Form //DexUIForm
It seems a bug in the DexUIForm class was preventing the event handler from working with the Void Historical Payables window. This problem didn’t occur with all windows; the SOP Transaction Entry window worked as expected. It appears there’s something specific about the Void Historical Payables Transactions window that triggered this bug.
This experience highlights a frustrating aspect of working with Dynamics GP: seemingly minor issues can consume significant time and hinder progress.
Despite the frustration, I gained valuable knowledge about VS Tools, Dynamics GP windows, and the Windows API. The journey was challenging, but the lessons learned were worthwhile.
Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles. He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.
You can also find him onGoogle+andTwitter

