Drill through on SSRS reports.

Drill through links in SSRS are controlled by C# code which produces a URL that can be processed to call AX which can open a form with the appropriate record. There is a common class (DrillThroughCommonHelper) that will need to be either referenced or modified if you would like to use a lookup in Your SSRS report. Firstly I would suggest that you open up the C# project to see if your lookup is already there.

Firstly navigate to \Visual Studio Projects\C Sharp Projects\SRSDrillThroughCommon and right click and select edit on the C# project. This will open it up in Visual Studio and you can open up the C# code. With the C# code open in the editor you can search for the EDT of your field or the form to find the correct method to call. In my example I was looking to use SalesId. A quick search for SalesId found a method that was already written that would produce the lookup.

If a custom method is needed you can use that as an example on how to produce the lookup, but in a nutshell there is a static method (GetDrillthroughUrl) that accepts the MenuItem that launches the form and the table, field and field value of the record you wish to open the form with.

With that method either found or created you can now reference that in your report. The first step is to create or add the C# projects to your report. With your report open in VS, add a new data method. With that done VS will add a new business logic project to your report project:

Next open up the AOT view within VS and find the C# project (\Visual Studio Projects\C Sharp Projects\SRSDrillThroughCommon) we opened earlier and double click on it which will add this to your overall project. With the project added now expand the business logic project and right click on the references node. Select “Add reference” and in the projects tab you will see the SRSDrillthrough project, select that.

You can now finish up the display method :

With this done you can now reference the new display method in our field, allowing the URL to be built. Locate the field in the report design and open up the properties of the text box. Select the action tab.

Select the URL radio button and put the following call to your display method in the expression (in this example the field is SalesID and it is located on the data set SalesInvoiceHeaderFooterDS)

Please remember to set the font colour as the SSRS report renderer does not change URLS colour automatically.