Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

Posted on by 321

I'm in the process of building my first GP add-in using VSTools. I've built the WinForm and the code I want to interact with the GP tables, but I'm not getting any traction on the process for actually calling this. I'd like to either:

1. Open the form from a shortcut in GP (similar to how you can add existing GP forms),

2. Add a menu item to GP under Routines which opens the form, or

3. Add an item to "Additional" in the SOP transaction entry window to open the form.

Any assistance, pointers to a relevant walkthrough or sample code would really help. I'm comfortable with building in VS2012, just not sure how to then call the form from within GP.

Thanks in advance for any help.

Garrett

*This post is locked for comments

  • Basil Ismail Profile Picture
    Basil Ismail 220 on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    Hi Steve,

    I have a situation where the drop down menu shows up for sa and POWERUSER but not for any other users. Is there a security role/task or something specific that needs to be done to make other users see it? Sorry, I didn't mean to hack this post but couldn't find anything on this.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    check github.com/.../DynamicsGP for code samples

    I am also new to VS Tools and C#

  • steveendow Profile Picture
    steveendow 2,281 on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    Hi Garrett,

    Andrew Dean and I gave a presentation on advanced VS Tools development at the recent reIMAGINE conference.

    You can download several sample VST projects via my blog post:

    dynamicsgpland.blogspot.com/.../reimagine-2014-pushing-boundaries-of.html

    I believe several of the examples involve custom menu items that launch windows within GP.  They are pretty stripped down sample projects, so hopefully you can track down how they are being triggered by a menu handler.

    Let me know if those help.

  • Devesh Kasat Profile Picture
    Devesh Kasat 165 on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    Can you try this one out (example code is in C#.NET)

    The following C# example shows how a menu handler for the “Estimate Freight” menu item is added to the SopEntry form in Microsoft Dynamics GP:

    Dynamics.Forms.SOPEntry.AddMenuHandler(OpenEstimateFreight,"Estimate Freight", "F");


    This code is the event handler for the menu item. Notice that it takes two arguments like standard event handlers.

    static void OpenEstimateFreight(object sender, EventArgs e)
    {
    if (EstimateFreightForm == null)
    {
    EstimateFreightForm = new EstimateFreight();
    }
    else
    {
    if (EstimateFreightForm.Created == false)
    {
    EstimateFreightForm = new EstimateFreight();
    }
    }
    // Always show and activate the WinForm
    EstimateFreightForm.Show();
    EstimateFreightForm.Activate();

    }

    Hope this helps!

    Regards,

    Devesh Kasat

  • Suggested answer
    Ian Grieve Profile Picture
    Ian Grieve 22,782 on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    Not done much myself in this area, but to get a VST window on the GP menu you need to use Menus for Visual Studio Tools for Microsoft Dynamics GP.

  • GTW Profile Picture
    GTW 321 on at
    RE: How to call a custom add-in from GP 2013 R2 as a menu item or shortcut

    Update: I've figured out how #3 is intended to work, and I have the menu items appearing in my Additional menu. However, it is not working as expected:

    1. When GP starts, both functions are called immediately (one opens a messagebox, the other opens my form)

    2. Clicking the item under Additional does nothing.

    I'm assuming there's something simple in my code that is causing this. Here's the code I'm using:

    Public Class GPAddIn

       Implements IDexterityAddIn

       ' IDexterityAddIn interface

       Sub Initialize() Implements IDexterityAddin.Initialize

           Dim SOPForm = Dynamics.Forms.SopEntry

           SOPForm.AddMenuHandler(Import.LaunchImportForm(), "Import Equipment Records")

           Microsoft.Dexterity.Applications.Dynamics.Forms.SopEntry.AddMenuHandler(Import.Test, "Test", "T")

       End Sub

    End Class

    Class Import

       Shared Function Test()

           MsgBox("Here we go")

       End Function

       Shared Function LaunchImportForm()

           Dim frm As New DynamicsGPForm1

           frm.Show()

           frm.Activate()

       End Function

    End Class

    I did find this article community.dynamics.com/.../43216.aspx that may be the same thing, but unfortunately the solution isn't explained.

    Again, any help appreciated here, I know I must be missing something simple.

    Garrett

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans