Notifications
Announcements
No record found.
Hey! I need to modify the form for canceling a sales order so that when a user wants to cancel an order, he should mention a reason. The value selected from the field must then be saved in a field in the header of the SalesTable form. I called the main method of my dialog class on the clicked method and in run I called the closeOk method on the order cancellation form (SalesCancelOrderDropDialog). How do I retrieve the RecId for SalesTable in the run method to be able to put a value in my field? Or should I modify the closeOk method on the form? Thanks!
Hi Pavel,
On the main method you will get the caller record. Seems you already passed the args to parmArgs method from main method.
On the run method you can get the SalesTable recid using parmArgs method like below.
Public void run() { SalesTable salesTable = this.parmArgs().record(); }
Thanks,
Girish S.
I don't think that click() method is the right place - use closeOk() instead.
There is no SalesCancelOrderDropDialog in F&O (and I don't have any AX 2012 environment), therefore I can't look at the implementation. But you can. The form surely know which order it is about - maybe there is an instance variable, a data souce or a reference to a table holding the data. The debugger may help you to locate the information. When you know where to get it, then you can easily pass it to your class.
Hi there! I would like to direct your attention to this article on creating good classes in Microsoft Dynamics AX: www.artofcreation.be/.../. This article provides valuable information and tips on how to create effective classes within Dynamics AX. You may also find the following code useful, although it is not the best solution as it shows some chaos in its structure.
Here is the code:
static void Job2(Args _args) { FormRun formRun; FormDataSource formDataSource; SalesTable salesTable; ; if (_args && _args.caller()) { formRun = _args.caller(); formDataSource = formRun.dataSource(); if (formDataSource.table() == tableNum(SalesTable)) { salesTable = formDataSource.cursor(); if (salesTable.validateWrite()) { salesTable.update(); } } } }
I hope this helps you resolve your issue.
Thanks, it worked for me!
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 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader