Notifications
Announcements
No record found.
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.
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"); } } }
You should solve this issue by debugging and drilling through starting from PurchFormLetter class.
Other recommandations makes you copy-paste without understanding the issue.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 660 Most Valuable Professional
André Arnaud de Cal... 549 Super User 2025 Season 2
Sohaib Cheema 307 User Group Leader