Reports and Data Methods

In this post, I will explain how to use data methods in Reports. We will use the same Report model and report that we created in Building a Simple Report–Precision Design.

In AX 2009, AX SSRS had good use of these data methods. But with much better integration, and Reporting framework in AX improving, Data Methods in AX SSRS are reduced to minimal use.

Also the reason is that MS is soon going to do away with .Net Business Connector from next version hence the usage of data methods for many things will be redundant. What I have also noticed is the data methods have return type only as System.String and you will not be able to change this return type. This means, data methods can only return strings.

What I will try and demonstrate here is how to add links in AX reports (to open the corresponding forms).

To achieve this first we will add the reference to SRSDrillThroughCommon project. Do the following:

  • Open the SKL_SampleReportProject (refer to link above)
  • In Application Explorer, right-click Visual Studio Projects > C Sharp Projects > SRSDrillThroughCommon and then click Edit. This adds the SRSDrillThroughCommon project to our current solution


  • Open the report SKL_SampleReportPrecision project
  • Right click on the Data Methods node and create a new DataMethod. Name it CustDrillDown
  • You will also notice that a Business Logic Project is automatically added


  • In Solution Explorer, right-click the business logic project and then click Add Reference


  • Go to “Projects” tab and select “SRSDrillThroughCommon” and click Ok


  • Double click the data method this opens the Code editor
  • Add this line of code the declaration

using Microsoft.Dynamics.AX.Application.Reports;


  • Your code editor should be like this

using System;

using System.Collections.Generic;

using System.Security.Permissions;

using System.Data;

using Microsoft.Dynamics.Framework.Reports;

using Microsoft.Dynamics.AX.Application.Reports;


public partial class SKL_SampleReportPrecision


    [DataMethod(), PermissionSet(SecurityAction.Assert, Name = “FullTrust”)]

    public static string CustDrillDown(string reportContext, string custAccount)


        return DrillThroughCommonHelper.ToCustomerForm(reportContext, custAccount);



  • Right click on Precision Design and open the designer
  • Select the AccountNum text box, underline the text and set font color to Blue


  • Now right click on this text box and select “Text Box Properties…”, Switch to Tab “Action”
  • Select option “Go to URL” and click button “fx


  • Set Expression “=CustDrillDown(Parameters!AX_ReportContext.Value, Fields!AccountNum.Value)”
  • Click Ok
  • Save report, go to AX, deploy the report and run it. You should see following


  • Click on the link and the customer form opens up



10 thoughts on “Reports and Data Methods

      1. Yes sumit for customer only,in my data method i am returning
        return DrillthroughHelper.GenerateLinkToAXMenuItem(reportContext, “CustTable”, Microsoft.Dynamics.Framework.Reports.MenuItemType.Display);
        And in action—GO TO URL–expression is =”DataMethod1(Parameters!AX_ReportContext.Value,Fields!AccountNum.Value)” given
        WARNING:URLs in report may only use http://,https://, help me out to resolve this issue

      2. First of all let me check this method. But if you wish to connect to Customers form, try using

        return DrillThroughCommonHelper.ToCustomerForm(reportContext, custAccount);

  1. Hi Sumit,

    In the above blog, the statement “Right click on the Data Methods node and create a new DataMethod. Name it CustDrillDown” and then in the next step “You will also notice that a Business Logic Project is automatically added”. But I have tried these both steps and the Business Logic project will not be automatically added. once we double click on the “CustDrillDown” method, then only it will get added in the solution.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s