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 :
Microsoft Dynamics AX (Archived)

Passing record from FormA to ProdParmReportFinished form using MenuItemButton

(0) ShareShare
ReportReport
Posted on by 6,478

Hello.

I have a Form1 with several controls and MenuItemButton.

As a datasource on Form1 I have Table1 which stores only one record.

As a MenuItemType on button I have "Action" and as a MenuItemName "ProdReportFinishedAction" which uses "ProdMultiReportFinished" class as an object.

What I want to do is to pass the record to the ProdParmReportFinished form using the MenuItemButton.

Please guide me how to do that.

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    The menu items triggers main() method of the class, which receives a single argument - args. You can get the record passed by calling args.record().

  • Suggested answer
    Community Member Profile Picture
    on at

    On MenuItemButton property set the DataSource property

    you need to specify the Form1 Datasource table name,

    now in 'ProdMultiReportFinished' class you can get the passed datasource record using

    args.record() in main method of the class.

    Please verify and update with your findings.

  • Johnny Profile Picture
    6,478 on at

    Thanks for your replies. I'm new in AX so if you can please provide me more information about the further steps in main method of the class. how exactly it should be done?

    Thanks..

  • Johnny Profile Picture
    6,478 on at

    Thanks.

    I also went to main() method but I could not proceed anymore : (

    I'm new in AX

  • Verified answer
    Community Member Profile Picture
    on at

    Hi joni,

    Like martin said in the above post we can get the particular record using the args.record() in main method of the class "ProdParmReportFinished".

    What you want to do with the data which you receive from class??

    For Example I am just wrote the code get the Sales Table information and display the sales id which is chosen in the Sales form in infolog.

    First create a class with the below class declaration and new method called main

    Class : Sales Action 

    The class declaration will be,

    class declaration :

    Public class SalesAction
    {

    }

    Add main method ,

    Main :

    static client void main(Args args)
    {
    Common record;
    SalesTable salesTable;// Your Table

    record = args.record();
    if (record is SalesTable)
    {
    salesTable = record as SalesTable;
    info(strFmt("%1",salesTable.SalesId));
    }
    }

    Then i craete a new action menu item and set the property
    Object Type : Class
    Object : SalesAction(Your Class Name)

    and then Add the menu item button in the SalesOrder(Add it in Your Form).

    Now i click the menu item in the form it will return the current record sales id in the infolog.

    Action Button in Sales Form:

    8054.Output.png

    Output :

    It just an example and instead of sales table you can change your table and form and do operation which you want with the record. or if you have any queries please let me know.

    Please verify if these details helps you..

    Thanks,

    Malleswaran

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans