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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to open VendEditInvoice form programmatically

(0) ShareShare
ReportReport
Posted on by

I have a need to open a Vendor Invoice programatically in X++ (by clicking a button in a custom form), given that I have the VendInvoiceInfoTable record I want to open.  I've tried opening the form directly, passing the record as args.record(), but something in the init code is failing.  I've tried using a new MenuFunction using PurchformLetter_InvoiceDisplay, and that didn't work either - I kept getting that "invoice in use"  dialog.

If anyone has successfully done this, an example would be greatly appreciated.

  • huijij Profile Picture
    19,813 on at

    Hi RichStephens,

    You can find a lot references to open VendEditInvoice form and passing parameters in AOT:

    [DataSource]
        class VendPostedUnionUnpostedInvoice
        {
            [DataField]
            class Num 
            {
                public void jumpRef()
                {
                    if (vendPostedUnionUnpostedInvoice.origTableId() == tableNum(VendInvoiceInfoTable))
                    {
                        Args args = new Args();
    
                        args.caller(element);
                        args.record(vendPostedUnionUnpostedInvoice.getTableRecord());
    
                        MenuFunction menuFunction = new MenuFunction(menuitemDisplayStr(VendInvoice), MenuItemType::Display);
                        menuFunction.run(args);
                    }
                    else
                    {
                        warning("@AccountsPayable:PostedInvoiceDetailsUnavailable");
                    }
                }
    
            }

  • barbarsav Profile Picture
    30 on at

    Hi RichStephens,

    You should solve this issue by debugging and drilling through starting from PurchFormLetter class.

    Other recommandations makes you copy-paste without understanding the issue.

  • Community Member Profile Picture
    on at

    I've already done that.  And I'm already doing what the previous person suggested.  I've already done the basics.  I'm looking for advice from someone who's actually made it work.  

    Debugging into PurchFormLetter reveals that it has it's own Datasource that needs the current record set.  Setting them in the args when you run the menufunction doesn't work.  It doesn't set them in the PurchFormLetter class.  There's no way to GET to the PurchformLetter class to get to them.

    So, again, if anyone has actually made this work, let me know, thanks!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 475 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 399 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 374

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans