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

Announcements

No record found.

News and Announcements icon
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

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans