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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Open other form on OK button click of first form using X++

(0) ShareShare
ReportReport
Posted on by 515

Hi All,

I need urgent help on below issue.

I have created two new forms. One is header creation form and other form contains header and line information.(just similar to SalesOrderCreate and sales table form). When I create any record from header creation form and press OK button on form then it should open second form which will list out header detail at top and at bottom we can create new line. To call this second form and to pass current header record detail I have written below code but it is not working. When I create any record it open second form but it is not showing recently created record(or linked record).E.g if I created header with SO 001 then after OK button click it opens second form and shows order detail for SO 002.

E.g. From Form A I am calling Form B.I have written below code on CloseOK method of Form A

    FormRun fr;
    Args    args;

    ZLG_LaborActivityHeader ZLG_LaborActivityHeader1;

    args = new Args();
    args = element.args();
    args.name(formStr('FORMB));

        args.record(element.args().record());
    fr = ClassFactory.formRunClass(args);
    fr.init();
    fr.run();
    fr.detach();
    super();

Kindly help. Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Open other form on OK button click of first form using X++

    if zlg_LaborActivityHeader is your tablename, your code should look more like this....

    FormRun fr;

       Args    args;

       args = new Args();

       args = element.args();

       args.name(formStr('FORMB'));

       args.record(zlg_LaborActivityHeader);

       fr = ClassFactory.formRunClass(args);

       fr.init();

       fr.run();

       fr.detach();

       super();

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Community Member Profile Picture

Community Member 2

#2
Mea_ Profile Picture

Mea_ 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans