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

Notifications

Announcements

No record found.

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.

I have the same question (2)
  • huijij Profile Picture
    19,811 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans