Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Using COM to Open a Form from an Application

Posted on by 50

Hi All,

I want from a .NET program open the AX Client with a certain form, customer form or open the form to create a sales order for this particular customer. The Customer number is known in the .NET program this variable is being defined.

I am not really familiar with .NET but I did succeed to open a form for instance the CustTable form, but as you guess at the top of the Grid.

In .NET it looks like this - see below, in the OpenMenuItem I can not put the Customer number there isn't a exporting parameter.

Question is this solvable ? Which way to go ?

private void button1_Click(object sender, EventArgs e)
{
       AxClientLib.DynamicsAxApplication axComClient = new AxClientLib.DynamicsAxApplication() ;


      try
     {
          //find running Ax32.exe
         axComClient.OpenMenuItem("100", "CustTable", AxClientLib.AxMenuType.DisplayMenu);

    }
   catch
   {
        MessageBox.Show("failed");
   }

  • csteenbe Profile Picture
    csteenbe 50 on at
    RE: Using COM to Open a Form from an Application

    i think this is not suitable for our version of ax, AX2009.

  • csteenbe Profile Picture
    csteenbe 50 on at
    RE: Using COM to Open a Form from an Application

    Thanks, trick is just how to open the customer form with the customer number as out/incoming parameter.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Using COM to Open a Form from an Application

    Yes, startup commands will only work when the client is started.

    If you need to send commands to AX client that is already open, you can use Named pipes: www.axug.com/.../viewthread

  • csteenbe Profile Picture
    csteenbe 50 on at
    RE: Using COM to Open a Form from an Application

    Thanks, only question mark is. Will the client always be started again, think so ?

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Using COM to Open a Form from an Application

    You can utilize AX startup commands. Basically you can develop x++ code to support running any commands when the client starts.

    docs.microsoft.com/.../execute-startup-commands

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans