Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee 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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans