A very common scenario is to customize reports by adding more fields to the dataset and modifying the layout. Until now, you would have to take full ownership of the report dataset (for example, a copy) just to make small changes, thereby forcing partners to maintain a full report and prohibiting multiple ISV contributions to the same report in an extensible way. With report extensibility, a new report extension object can be created, which adds new fields to the dataset or a new layout.
In below example will discuss how we can crate Report Extension and extend the Base Reports. In this blog will extend Report “Customer - Sales List”, So before we extend the report, we will check what are the details available in Report “Customer - Sales List”.
Hence, we will open business central and Search for Report “Customer - Sales List” as per below screenshot -
Click on Report, then click on Preview, you can see that Report “Customer - Sales List” having the column like No., Name with Address Details, Tax Registration No. and Amount of Sales.
As per our requirement If we need only “No.”, Name, and “Salesperson code” in “Customer - Sales List” then we do it by Report Extension in Business Central 2021 Wave 1. There is no need to create new report for this requirement.
We will discuss in below steps how we can use report extension object and can extend Base Reports.
Step 1: Type treportext and it will give you the Report Extension snippet, Select the Report Extension Snippet as per below screenshot-
Step 2: Now define the Report Extension ID, Report Extension Name and Report Name which we are going to extend. Here we are going to extend Report “Customer - Sales List”, Hence I have defined “Customer - Sales List” and given my report extension name as ExtendCustomerSalesList.
Step 3: As my report “Customer - Sales List” is based on Customer DataItem, so here I will also add Customer DataItem in my Report Extension and add additional column Salesperson Code, as Salesperson Code is not available in the dataset of base report “Customer - Sales List”. Also, I need to define the RDLC Layout Property (ExtendCustomerSalesList.rdl) for this Report Extension. Please refer below screenshot-
Step 4: Once you have done the above changes, just compile your package and you can see layout (ExtendCustomerSalesList.rdl) for Report Extension is generated.
Step 5: Then you need to right click on the ExtendCustomerSalesList.rdl and Click on Open Externally then your layout will open in Report Builder. As per our requirement we need to only column “No.”, Name, and “Salesperson code” in the Layout, Hence I have added these columns in my layout (ExtendCustomerSalesList.rdl) and saved the layout changes.
Step 6: Once you have done the above changes, just compile your package and Publish it.
Step 7: Once your changes will be published to the server, then you need to go to Report Layout Selection –
Step 8: Then you need to change the Layout from Default to ExtendCustomerSalesList.rdl for Report 119 (Customer - Sales List).
Step 9: Once you have done the above changes, then run Report (Customer - Sales List), Click on Report, then click on Preview-
Step 10: Now you can see, Report (Customer - Sales List) it is showing the details as per our Report Extension layout ('ExtendCustomerSalesList.rdl’)
Hope this helps!!