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
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.
check github.com/.../DynamicsGP for code samples
I am also new to VS Tools and C#
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.
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
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.
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156