web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Calling An External API from within GP

(2) ShareShare
ReportReport
Posted on by 1,912

Hello,

I need somebody to point me in the right direction as far as calling an external API from within a GP window is concerned. The API is for recalculating some values, on a need basis. Any recommendations, and possible snippets are welcome. VBA, GP VS Tools any other way?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    which API you want to use, is it a custom one?

  • Peter Muchira Profile Picture
    1,912 on at

    Hi Almas,

    Yes, it is a custom(3rd party) API. Any leads?

  • Suggested answer
    Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    in Dex 14. Sample code there is a dictionary 'NETInterop' , check it to get idea of using custom API in your code.

  • Peter Muchira Profile Picture
    1,912 on at

    Thanks. Do you know if this can be achieved via GP VS Tools (or VBA for that matter)?

  • Suggested answer
    Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    GP VS Tools can easily be done, more flexible then doing in dexterity.

    I never tried VBA but I don't see any reason it can not be done in VBA.

  • Peter Muchira Profile Picture
    1,912 on at

    Thanks Almas. Any sample for VS Tools with this functionality would be appreciated.

  • Suggested answer
    Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    Currently I don't have any code snippet in access to share but if you have VS Tools installed you can have idea from programmers Guide pdf and sample codes. Also try google search

  • Suggested answer
    JamesLyn Profile Picture
    360 on at

    The below is sample code you can think of using. It is written in C# using the GP SDK. Once you build it, the dll goes into your local installation's add-in folder. The menu handler will appear on the chosen form's "Additional" menu at the top toolbar (the sample code attaches the procedure to the manual journal entry window) which you can also assign a hot-key to if you choose to. I have other code snippets on my blog if you need other examples: jamesdlyn.wordpress.com

    using System;

    using System.Collections.Generic;

    using System.Text;

    using Microsoft.Dexterity.Bridge;

    using Microsoft.Dexterity.Applications;

    using Dynamics;

    using System.Windows.Forms;

    using System.Data;

    namespace GPAddin

    {

       public class GPAddin : IDexterityAddIn

       {

           // IDexterityAddIn interface

           public void Initialize()

           {

               //Financial Transaction Entry

               Microsoft.Dexterity.Applications.Dynamics.Forms.GlTransactionEntry.AddMenuHandler(myProcedure, "My Procedure");

           }

           static void myProcedure(object sender, EventArgs e)

           {

               //Latch ontop current Dynamics application

               Dynamics.Application GPApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));

               if (GPApp != null)

               {

                   //MessageBox.Show("Not Null");

               }

               int intErrorValue;

               string strErrorMessage;

    // INSERT YOUR CODE HERE

           }

       }

    }

    ~James

  • Community Member Profile Picture
    on at

    I am also working on having a third party API communicate with a GP window, similar to Peter's situation. I have been looking into have the action be called by a push button on the GP window, but have found surprisingly little in the way of code examples for even basic operations. Do you have any examples of coding a push button or perhaps a link for information of the like?

  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    @Jon Berardinelli: please email me at almasmahfooz@hotmail.com about details of your operation, so I will help you out with this.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans