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)

How pass data from form to Class?

(0) ShareShare
ReportReport
Posted on by

Hi

I have form with fields: date, customer, sales order, item and etc. 

I need after click button pass this data to my user class, where i will use in method how parameters. Explain me, please, how pass? Thanks for advance.  

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at

    There are many ways to do this, and they depend on the conditions of your scenario.

    Is the class on the server or on the client?

    If it is on the client, you will be OK with just creating parm methods in the class for each of the data fields you want to pass over:

    parmCustomerAccount(), parmSalesOrder(), parmItem(), etc.

    and in the clicked method overridden on the button, create a new instance of your class and invoke each of these methods in turn, passing in the corresponding data.

    If the class is on the server, it's a bit more tricky, as you'll also want to avoid multiple RPC calls, so you'd want to pack the data before it is being passed, which depends on the types of data you are passing - if they are simple value types, easy, just use a container, if however you have records in there as well, it will depend.

    Alternatively, depending on the number and types of fields you need to pass to the class, you can use the Args() class and have the button be an actual menuItemButton.

    Some examples of this here:

    http://arsalanax.blogspot.dk/2012/01/passing-paramters-between-forms-in-ax.html

    dynamicsuser.net/.../51236.aspx

    So describe your scenario a bit better, if the above does not help.

  • maxhammer Profile Picture
    on at

    Thank you, Vanya.

    Scenario:

    Will be created to review all invoiced sales order lines and gather data from the ended production order. The gathered data will be written to a new transaction table. The new transaction table will be the source of the data generated by this report. The fields stored will be: Plant, Customer Account, Process, Operation, Order Number, Invoice Number, Invoice, Date, Article (Item), Quantity, Weight, Sales Line Amount, Value by Line, Value by Weight.

    A standard report dialog will be generated and presented to the user for input. After the user’s input is captured, the new transaction table will be queried and the data presented in a simple grid based form with the raw data that can then be exported for further analysis and formatting.

  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    Go with my first suggestion for now, where you have individual methods for the various data.

    Let us know when you succeed.

  • Suggested answer
    Community Member Profile Picture
    on at

    If your button is a menuItem then you can access the caller form data source

    in menuitem buttons specify the datasource property as forms datasource name

    using following method

    args.caller().record();

    you can write this statement main method

    Please verify if this helps you solve your requirement

  • maxhammer Profile Picture
    on at

    thank you

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