What's New in Visual Studio Tools 2010

Patrick Roth - Click for blog homepageToday, I want to share with you what I think are the 3 coolest new features in Visual Studio Tools for Microsoft Dynamics GP 2010 (VSTools).

Modal Dialog Notifications

In this version, VSTools joins VBA with the capability for modal dialog notifications.  The VSTools implementation of this functionality is the same.

By getting a “BeforeModalDialog” notification, the VSTools developer has the opportunity to change the message displayed to the end user or even answer the dialog for the end user so the dialog is not displayed.

By getting an “AfterModalDialog” notification, the VSTools developer can get the response the user selected to the modal dialog and take action based upon that response.

Modal Dialog notifications are per window.  For each window, any type of modal dialog generated by ask() or warning statements will trigger the handling script.

Modal Dialog Handler

public void Initialize()
{
     Dynamics.Forms.PmVendorMaintenance.PmVendorMaintenance.AfterModalDialog +=
       new EventHandler<AfterModalDialogEventArgs>(PmVendorMaintenance_AfterModalDialog);
}

void PmVendorMaintenance_AfterModalDialog(object sender, AfterModalDialogEventArgs e)
{
     if (e.Message == "Do you want to save changes?")
       MessageBox.Show("The user selected " + e.Response.ToString());             
}

Table Buffers as Parameters

With this version, the dag.exe will now generate procedures & functions for scripts that have table buffers.  The developer will be able to call these procedures and get or set values in the tables passed from and back from the script.

VSTools still has the restriction in that procedures/functions are not generated for procedures with reference or anonymous parameters.

Function and Procedure Notifications

I think one of the best and the biggest features added in VSTools is the ability to have function and procedure notifications. This is essentially the same functionality that Dexterity enjoys.

Script Notification Sample

public void Initialize()
{
   Dynamics.Procedures.AddSuccessfulLoginRecord.InvokeAfterOriginal += 
      new AddSuccessfulLoginRecordProcedure.InvokeEventHandler(AddSuccessfulLoginRecord_InvokeAfterOriginal);
}

void AddSuccessfulLoginRecord_InvokeAfterOriginal(object sender,
    AddSuccessfulLoginRecordProcedure.InvokeEventArgs e)
{
    MessageBox.Show("User " + Dynamics.Globals.UserId.Value + " was logged in successfully.");
}

With these changes, VSTools 2010 gains signifigant capabilities developers will find valuable.

Best regards,
Patrick

// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, https://opensource.org/licenses/ms-pl.html.)