/ Microsoft / Running an SSRS report from the selected record

Running an SSRS report from the selected record

Learn, share and spread knowledge

SSRS reports are used to display data in an organized way. It helps the users to get the data as per their own business formats and scenarios. In Microsoft Dynamics 365 for Finance and Operations or in Microsoft Dynamics AX 2012, SSRS reports play a vital role for the users. Without this, business applications are incomplete. Moreover, running an SSRS report from the selected record of a form is very commonly required by the users.

There are multiple default reports in Microsoft D365FO and Microsoft DAX2012. In my previous article, I have shown you how to Customize SSRS report using extension in D365FO.

In my this tutorial, I will show you how to run an SSRS report from the selected record in a form in Microsoft D365FO and in Microsoft DAX2012. It is very helpful as this is very common requirement.

Let’s start!

I am creating a new report from scratch. I am using the Microsoft D365FO environment for the development of the report from scratch. For example, I am creating a Purchase order report.

I have already shared an article about how to Create SSRS report in D365FO. You need to follow that article completely and then come back to this tutorial.

All the steps are mentioned in the article: Create SSRS report in D365FO.

After completing all the steps of the article create SSRS report in D365FO, you would have the following elements in your project:

  • RDP Class
  • Controller Class
  • Contract Class
  • Temporary tables
  • Report
  • Output menu item
  • Form extension

After that, you have to override a function of controller class. Just copy and paste the following function in the controller class:

protected void prePromptModifyContract()
{
     PurchaseOrderContract contract = this.parmReportContract().parmRdpContract() as PurchaseOrderContract;
     if(this.parmArgs().dataset() == tableNum(PurchTable))
     {
          PurchTable purchTable = this.parmArgs().record() as PurchTable;
          contract.parmPurchId(purchTable.PurchId);     
     }
}

I have already mentioned the properties of the Output Menu Item and the form’s Menu Item Button in Create SSRS report in D365FO. But, because it is too much important, so I am mentioning them again below:

Set the properties of output menu item as follows:

  • Object: PurchaseOrderController
  • Object Type: Class
  • Subscriber access level: Unset
  • Needs Record: Yes

Create an extension of form in which you want to show the output menu item. In this scenario, you should add the button where the Main Data Source table is PurchTable. As, we are fetching the record from the form using the prePromptModifyContract() function.

We have created the Purchase Order Report with the Purchase Order Number (PurchId) as the parameter. So, we should use the PurchTable form.

So, create extension of the form by right-clicking the PurchTable in AOT->User Interface->Forms. Then click the Create extension. In the project, an extension of the PurchTable form would be created. In the form, create Menu Item Button and set the properties as follows:

  • Data Source: PurchTable
  • Needs Record: Yes
  • Menu Item Name: Name of OutputMenuItem
  • Menu Item Type: Output

Note: Needs Record and Data Source properties are only required if you are running an SSRS report from the selected record of a form. Otherwise, it’s not mandatory.

Also, see the article about how to Create SSRS report in D365FO and how to Customize SSRS report using extension in D365FO.

Running an SSRS report from the selected record is well-explained above. If you found any ambiguity or a better solution, please let me know. If this helps you, please Like, Comment and Share to help other community members.

Blog: Click here

YouTube: Click here

GitHub: Click here

I never dreamed about success. I worked for it. – Estée Lauder

0 POST COMMENT

Send Us A Message Here

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

NevoiTech Blog

A blog by Moeen Ahmed SultanNevoiTech logo

To hire freelancer or get personal training

of

Microsoft Dynamics 365 for Finance & Operations

Call Us: +92 321 458 9595