Dynamics Search Engine

Thursday, June 5, 2008

How to open Dynamics Ax form through X++ code

This article shows how to open forms in Dynamics Ax through X++ code.
Note: Use at your own risk.
You should be familiar with X++ basic programming.

I applied it on Dynamics Ax 3.0

1) Open your Ax application then AOT.
2) Go to Jobs node and create a new job.
3) Add the following codes in your job to open a form by menuitem name.

MenuFunction menuFunction;
;
menuFunction = new MenuFunction(MenuItemDisplayStr(CustTable), MenuItemType::Display);
menuFunction.run();

Your job will look like:

static void Job1(Args _args)

{
MenuFunction menuFunction;
;
menuFunction = new MenuFunction(MenuItemDisplayStr(CustTable), MenuItemType::Display);
menuFunction.run();
}



You can open your form by form name also.
1) Create a new job.
2) Copy the below code and paste to your job.

static void Job2(Args _args)
{
Args args;
FormRun formRun;
;
args = new Args();
args.name(formstr(CustTable));
formRun = new FormRun(args);
formRun.run();
formRun.wait();
}


3 comments:

  1. How can a form be opened from a user contorl used in the Role Center page - and behave like the cues or unified worklist ?

    ReplyDelete
  2. If I am not wrong, your requirement is:
    You have a user control located in AOT and you have a link on Role Center to open that user control from role center.
    Yes, it’s possible. On role center you can place your ax form links and enterprise portal (EP) form (user control) links.
    If this not your requirement, you may explain in details and I will get back to you shortly.

    ReplyDelete
    Replies
    1. Hej næsten 5 år efter der sidst er skrevet i denne tråd finder jeg alligevel denne til at være det tætteste på mit problem.
      Fra rollecenteret (indlejret i en ax 2009 klient) vil jeg gerne kunne åbne en ax form i samme ax klient. Er det muligt? Hvorledes?
      Mon der går 5 år før der er svar? :-)
      vh Bo Falk Myhlendorph

      Delete