Things to know before you get started

1. Prerequisites

  • Microsoft Dynamics AX 2012 R2
    • Visual Studio 2010
    • Visual Studio Tools (Can be installed via the AX Setup, follow this link for more information)
  • Microsoft Dynamics AX 2012 R3 CU8 and newer
    • Visual Studio 2013 (Professional or higher)
    • Visual Studio 2013 Dev Tools (Can be installed via the AX Setup, follow this link for more information)

When developing SSRS reports or editing existing SSRS reports for Dynamics AX 2012 we need Visual Studio as well as Visual Studio Tools. Visual Studio Tools integrates the development of Microsoft Dynamics AX with Visual Studio.

2. Elements to work with

We are going to do changes to the following elements in the AOT:

  • Tables (We will be editing the TMP table for the report)
  • Classes (We will be editing the DP class of the report)


Step by step…

So let’s get started! Today we we’ll be editing the Sales Invoice Report. We are going to add the Customer Group to the header of the report.

  1. Before I do anything with Visual Studio I always check the local Dynamics AX configuration. I want to work in a development environment and in the CUS layer as well. I have created a configuration file that points to the DEV environment and the CUS layer for this example, and I have imported this into the configuration utility. By doing this I’m certain that I will be working against the SSRS reports from the DEV environment and the CUS layer in DEV:


2. With the correct configuration set I will boot up the client by going to the start menu and search for “ax32”. This will open the client using the configuration set in the configuration utility. When working with SSRS reports for Dynamics AX we want to open Visual Studio from the client.


3. With the client open I will hit “Ctrl + D” to get into developer workspace. From the AOT we need to navigate to the “Visual Studio Projects” node, expand it and then expand the “Dynamics AX Model Projects”. Here I can see a list of all the Report projects in AX.


4. I will do a search for the “SalesInvoiceReport”, select it and hit “Edit”. This will now take me to Visual Studio with the correct configuration.


5. So we now have the SalesInvoiceReport project open in Visual Studio. Nice!


6. With this open I will jump back into AX. Here we need to create a new project so we have better control over the elements that we will be editing in the AOT. To the right for the AOT button in AX you will find the Projects button. Go ahead and create a new project.


7. We need to add some elements to the project. Right click your project and select “New -> Group”. Do this five times. We need to create a group for the following:

  • DataDictionary
  • Tables
  • Classes
  • VisualStudioAXModelProjects
  • SSRSReports

You can change the ProjectGroupType in the properties pane. I always copy the ProjectGroupType into the “Name” as well of the group object.


8. Ok cool, we got a nice and clean project, but we also need to add the different elements that we are going to work with inside the matching groups. If you open a new AOT window you can just drag and drop the different elements into the groups.


9. Add the following elements to the project:

  • SalesInvoiceHeaderFooterTmp (The temporary table that the report is using)
  • SalesInvoiceDP (The data provider class)
  • SalesInvoiceReport project
  • SalesInvoice SSRS report


10. We will start by adding a new field to the TMP table. Right click the fields node and add a new String field, and give it a fitting name. This is the field that we are later going to populate inside the Data Provider Class. Save the table.


11. Then navigate to the Data Provider class (SalesInvoiceDP), expand the node and open the InsertIntoSalesInvoiceHeaderFooterTmp method:


12. Add this code to the method. Save and compile:

//Added value to new field – begin
salesInvoiceHeaderFooterTmp.AdCustGroup = custInvoiceJour.CustGroup;


13. OK, so we are done with the AX stuff. Now we can jump back into Visual Studio. First of all we have to refresh our dataset because we have to tell Visual Studio that we have added a new field to the table that the report is pulling it’s data from. Right click the “SalesInvoiceHeaderFooterDS” and select “Refresh”.


TIP! If you are wondering which dataset points to the different tables you can mark the dataset and then in the properties pane, hover the mouse over the “Query” property.


14. If you expand the dataset node you will see the new field added to the dataset:


15. When I work with existing reports in AX I usually make a copy of the original design. Just rename it to “Report_Orig”. If anything happens you have a backup :). Then go ahead and edit the “Report”.


16. Do the following. Also, check the visibility on the text boxes. Set the visibility to “Visible”.


17. Then right-click the text box to the right and select “Expression…”


18. This will open the Expression editor. Here we will add the field to be displayed in the textbox. Add the custGroup field (Double click)


19. We also want to add a label to the other textbox. This give a brief description of what the field contains. Head back into AX, then go to Tools->Label->Label Editor


20. Do a search for <customer group>. Copy with you the ID of the label and jump back into Visual Studio.


21. Go into the Expression of the other textbox you created and paste in the label you copied. Save the report.


22. Go back to the Solution Explorer and Deploy the solution. This will the deploy the report with the newly added changes to the report server.


23. Go ahead and print a invoice in AX. Voilà! Your customer group field should be visible in the report.


That’s it for now. Leave a comment or send me an email if you have any questions! Good luck!