Publishing SSRS Reports on an Enterprise Level

Publishing SSRS Reports on an Enterprise Portal

In this blog we are going to learn how to publish an SSRS report on an enterprise portal for Microsoft Dynamics AX 2012.

The report is already developed using Data Contract and Report Data Provider classes. It requires 3 parameters to be filled by users to publish data to the report. Parameters include fields of Customer Account, From Date and To Date.

Problem statement:

By default, SSRS report under Microsoft Dynamics AX menu requires parameters to be completed before displaying on the portal. In this case, users have to edit the page and set parameter values as HARD CODED.


In this tutorial, we will develop User Control that contains the following from Visual Studio Tool box pane:

  1. AX Multi section
  2. AX Section
  3. Labels
  4. Text boxes
  5. AX Lookups
  6. AX Date pickers
  7. Button
  8. AX Report viewer

The execution sequence of user control is as follows:

  • User will select the following values using Lookups
    • Customer Account
    • From Date
    • To Date
  • Text boxes will be filled by values entered by user in the previous stage
  • User will click View Report
  • Values from text boxes will pass to Data Contract class of the report
  • Temporary table will be filled by data fetched based off on business logic written in Report Data Provider class
  • Data will be published to the report
  • Report will be fetched through AX report viewer control and displayed on webpage.

Step by Step Setup:

Step-1: Develop a report using Contract class and temporary table (table will be filled based off on the code written in Data Provider class), and add to a shared project EP_SalesRegisterReport

Step-2: Open SALES Module in enterprise portal as follows: Go to Site Actions --> More options

Step-3 : Create a new page of type Web Part Page

Step-4 : Set the following page properties:

  1. Name
  2. Layout template
  3. Document library
And click Create

New page will be added as below.

Step-5 : Go to the Development Workspace of AX and right-click on the created group EnterprisePortal_Objects. Add a new URL object to this group as per below:

Step-6 : Set the following properties for URL

  1. Name
  2. Label
  3. Help text
  4. URL

For setting the URL property

Step-7: Right click on URL and click Import page. An info log of successful page import will be displayed.

Step-8: After importing, Page definitions are created.
AOT --> Web --> Web Files --> Page Definitions --> EP_SalesRegisterWebPartPage
Drag page definition to the shared project as well. Set Page Title property of page definition by giving a title that will be displayed in the portal.

Step-9: Open the Microsoft Visual Studio:

  1. Click on new Project.
  2. Select Microsoft Dynamics AX Template
  3. Select EP Web Application
  4. Set the name of project and click OK. (We set it as EP_SalaryRegisterVSProject here.)

Step-10: Right click on “solution” in Solution Explorer, hover the cursor on Add option, and on New Item.

Step-11: From Add new item window:

  1. Select Item template Microsoft Dynamisc AX
  2. Select Item template EP User Control
  3. Set Item Name and click Add. (We will set the name as EP_SalesRegisterReportWebControl)

Step-12: In the design view of the EP User Control perform the following steps.

  1. Go to Toolbox, expand Dynamics AX section
  2. Select AXMultiSection tool and drag it to Design.
  3. Set properties like ID of multi-section in properties window. (We will set ID as EP_SalesRegisterMultiSection.)


  1. From the Toolbox expand the Dynamics AX section
  2. Select AX Section tool and drag it into to an already added AXMultiSection.
  3. Set properties like ID of the section in the properties window. (We will set ID as EP_SalesRegisterSection.)

Step-14: Open the Source code view and add the following code within the tag of (AXSection)

<asp:Label ID="lblCustAccount" runat="server" class="AxGroupHeaderCell"
Text="Customer account"/>
<asp:TextBox ID="CustAccountTxt" runat="server"></asp:TextBox>
<dynamics:AxLookup ID="LookUpCustomer" runat="server"
DataLookupField="AccountNum" DataSet="CustomerList"
DataSetView="CustTable" TargetControlId="CustAccountTxt" >
<td align="center" rowspan="3" valign="bottom">
<asp:Button ID="BtnViewReport" runat="server"
OnClick="ViewReportButton_Clicked" Text="<%$ AxLabel:@SYS334714 %>"
Height="26px" Width="89px" />
<asp:Label ID="lblFromDate" runat="server" class="AxGroupHeaderCell" Text="From date"/>
<asp:TextBox ID="FromDateTxt" runat="server"></asp:TextBox>
<dynamics:AxDatePicker ID="FromDatePicker" runat="server"
TargetControlId="FromDateTxt" TimeTextBoxTargetControlId="FromDateTxt" />
<asp:Label ID="lblToDate" runat="server" class="AxGroupHeaderCell" Text="To date"/>
<asp:TextBox ID="ToDateTxt" runat="server"></asp:TextBox>
<dynamics:AxDatePicker ID="ToDatePicker" runat="server"
TargetControlId="ToDateTxt" TimeTextBoxTargetControlId="ToDateTxt" />

This code will create a web control design as follows:

Step-15: Add the following code the AXReportViewer control in web control

<p>&nbsp;<dynamics:AxReportViewer runat="server" ID="SalesRegisterReportViewer" MenuItemName="SalesRegister" />

note: Here in MenuItemName="SalesRegister" /> "SalesRegister" is the output menu item name of the report.

Step-16: In the Design view of the Web control, double click on the View report button. Replace the following code with this.

using System;
using System.Collections.Generic;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using BCProxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;

public partial class EP_SalesRegisterReportWebControl : System.Web.UI.UserControl
    #region Private Methods

    /// Get the AxSession object.
    private ISession AxSession
            AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
            return webpart == null ? null : webpart.Session;


    protected void ViewReportButton_Clicked(object sender, EventArgs e)
        Dictionary parms = new Dictionary();
        if (this.CustAccountTxt.Text != string.Empty)
            parms.Add("SalesRegisterDS_CustAccount", this.CustAccountTxt.Text); 

        if (this.FromDateTxt.Text != string.Empty)
            parms.Add("SalesRegisterDS_FromDate", this.FromDateTxt.Text);
        if (this.ToDateTxt.Text != string.Empty)
            parms.Add("SalesRegisterDS_ToDate", this.ToDateTxt.Text);


Step-17: In the development workspace environment, following objects are created in AOT upon adding Visual Studio Project to AOT in Visual Studio

  1. AOT --> Visual Studio Projects --> Web Application Projects --> EP_SalesRegisterVSProject
  2. AOT --> Web --> Web Files --> Web Controls --> EP_SalesRegisterReportWebControl
  3. AOT --> Web --> Web Content --> Managed --> EP_SalesRegisterReportWebControl
  4. Drag the objects created above to Shared Project created in Step 1

Step-18: We added a new page on Enterprise portal in Step- 4. Add a web part as follows:

Step-19: Edit Web Part

Step-20: Select the Managed Content Item and click OK. Then click Stop editing from ribbon bar

Step-21: Here is the output of report. Cheers!!!

Muhammad Luqman's picture
A Microsoft certified professional working as Advisory Software Engineer at Systems limited with 5 years of experience in Microsoft Dynamics AX and D365 Finance for Operations implementations.

Disclaimer: The views expressed here are solely those of the author in his private capacity and do not in any way represent the views of Systems Limited, or any other entity related to Systems Limited.

Add new comment