Aaron Berquist Rotating Header Image

Passthrough Dexterity

Creating Custom Desktop Alerts In Dynamics GP

Sample Desktop Alert

First off, full credit goes to David Musgrave for sharing the bulk of this code with me and for providing some great troubleshooting help as I worked to call the code properly from VBA.

Allow me to share some background information. While at Convergence 2012 in Houston this year, I attended a presentation on the Support Debugging Tool by David Musgrave and Mariano Gomez. (Protip: I’ve found the sessions they run to be the most valuable ones at Convergence, by far.)

At the session, David mentioned in passing that the Support Debugging Tool was configured to raise a “Desktop Alert” when certain criteria were met. As soon as he demoed this, I thought – this would be a great way to provide feedback to a user without interrupting their workflow. Up until now, any time I wanted to provide a message to the user (such as “Data Saved”, etc) the only tool I had in my toolbox was a message box which they would have to click on to dismiss.

After emailing David with some questions about how he had implemented this feature, and with a lot of hand-holding from him as well, I had managed to code up a subroutine in VBA (and later, VB.NET) which I could call from a customization to send a Desktop Alert to the user. Here is a sample:

Sample Desktop Alert

The code to do this is actually pretty simple, and uses the (unsupported, undocumented) pass-through Dexterity method to call the Dexterity code which raises a desktop alert:

VBA / VB.NET

Public Sub RaiseDesktopAlert(AlertTitle As String, AlertMessage As String)
        'Author: Aaron Berquist
        'Date: 07/16/2012
        'Purpose: Raise a Dynamics GP "Desktop Alert" message in the bottom right-hand corner of the screen.
        'Inputs: 
        'AlertTitle - The title to be displayed in the Desktop Alert
        'AlertMessage - The message to be displayed in the Desktop Alert
        'Based on sample code provided by David Musgrave
        'http://blogs.msdn.com/b/developingfordynamicsgp/

        Dim CompilerApp As Object
        Dim compilercommand As String
 
        CompilerApp = CreateObject("Dynamics.Application")
        Dim CompilerError As Integer
        Dim CompilerMessage As String = ""
 
        CompilerCommand = "local string IN_Title;" & vbCrLf
        CompilerCommand = CompilerCommand & "local string IN_Message;" & vbCrLf
 
        CompilerCommand = CompilerCommand & "IN_Message = " & Chr(34) & AlertMessage & Chr(34) & ";" & vbCrLf
        CompilerCommand = CompilerCommand & "IN_Title = " & Chr(34) & AlertTitle & Chr(34) & ";" & vbCrLf
        CompilerCommand = CompilerCommand & "call wfDisplayDesktopNotification, IN_Title, IN_Message;"
 
 
 
        'Set the Product ID to 0 (Microsoft Dynamics GP)
        CompilerApp.CurrentProductID = 0
        'Execute SanScript

        CompilerError = CompilerApp.ExecuteSanscript(compilercommand, CompilerMessage)
    End Sub

I hope you find this code useful. I have have good feedback from several users now who appreciate the fact that the Desktop Alert does not interupt their workflow, yet still provides valuable feedback to them about certain actions which have occured inside the system.

Post to Twitter