Passing Arguments to a Data Provider Class in Dynamics AX

by | Updated August 15, 2016 | Development, Dynamics AX, Reporting

Many Dynamics AX reports utilize Data Provider classes, so when modifying existing reports or creating new ones, there is often a need to pass information to the DP class from the report controller class. Here is a simple example of how this can be done.

In this example, the customer has two menu items on a form calling the same report, and the report needs the information about which menu item the user selected.

First we need a new parm method on the data contract so that we can set the value from the controller class and later retrieve it in the DP class.

The DataMemberAttribute attribute identifies our parm method as a member of the data contract.
As is usually the case, the report controller class is called from the Output Menu Item and since Args is passed to the Main() method we can utilize Args().MenuItemName to retrieve the user’s selection as in the screen shot below…

Classes PSA Purchase Order Controller

Finally, from the DP class we can simply instantiate the contract and get the value…

Classes Purchase Order DP

 

 

Related Posts

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

august

12aug10:00 am10:30 amWhy Levridge Grain? How to Achieve Efficient and Accurate Scale Tickets

12aug12:00 pm1:00 pmThe Three Paths to Dynamics 365 Finance and Supply Chain from Dynamics AX

13aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Inspire Keynote Breakdown

19aug10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

19aug12:00 pm12:30 pmThe Modern Manufacturer - Death by Safety Stock

27aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview

september

02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X