How to extend standard report in Dynamics 365 Business Central

Dynamics 365 Business Central

Hello everyone.
As you know, if you want to extend standard features in Business Central, you must use Extensions. For example, if you want to extend the standard tables, you can use table extensions. If you want to extend the standard pages, you can use page extensions. Same goes for Enum. But what if you want to expand the standard report?

Let’s first take a look at all object types up to BC17. For extensions, there are only three types, Page Extensions, Table Extensions and Enum Extensions. So no Report Extensions until now. (20200925)
Object Type:

But customers may need to modify standard reports. How to do it.
There are two situations here.
1.Only need to modify the layout of report, no need to add DataItem (New fields).
2.Need to add Dataitem (New fields)
The difference between the two situations is mainly whether you need to add new fields to display in the report.

Before discussing in detail, let’s learn about the types of report layout first.
Word: You can change the layout directly in the Word.

RDLC: You need to use “Report Builder” to edit it.
Download Link: Microsoft Report Bulider

As an example this time, I want to use “Order Confirmation (205, Report Request)” to explain in detail.

OK, let’s get started.
1.Only need to modify the layout of report, no need to add DataItem (New fields).
Open “Report Layout Selection” page and find the report you want to modify.

Click “Custom Layouts”.

On the “Custom Report Layouts” page, click “New” to create a new layout.

Since the original layout type of this report is RDLC, this time I created it the same as the original one.

Created successfully.

Click “Layout -> Export Layout”.

The newly created report layout will be downloaded.

Open RDLC file with Report Builder.

You can modify the position of the fields, delete fields you don’t need, add preset fields and so on here.

After you finish it, you can upload it to Business Central.
Click “Import Layout” on “Custom Report Layouts” page.

Then back to “Report Layout Selection” page.
Choose “Custom Layout” in “Selected layout” field.

In the pop-up screen, select your modified Layout, then click “OK”.

The layout has been changed and applied.

You can also run report on this page.


2.Need to add Dataitem (New fields)
If you need to add a Dataitem (New fields), you must first find the standard source code of the report. Copy to a new one. Then modify it.

For example:
Create a new project and copy the source code of the standard report. (al file and rdlc file)

Then give al file a new object number and name.

At this point, you can make any modifications to this report, because this report has changed from standard to PTE.

Of particular note is this report is created by copying the standard report of the current version. If there are any changes to the standard report by Microsoft later, the copied report also needs to be modified manually.

I will give a simple example here.
In Japan, the company seal is required on many reports. So like the company logo, I will add a new field to the “Company Information (79)” table to save the company seal and then display it in the new report.

Add “Company Seal Picture” field to “Company Information” table.

Show this field on the page.

After publish, we can confirm that this field has been added.

Add a sample company seal.

Open the copied report object.
I first created a new variable.

Then add new field to the DataItem.

CalcFields it in “OnPreReport” trigger.

Finally, add this field to the RDLC file.

Publish and test it.

Succeeded.

Above is the instructions of how to extend standard report in Dynamics 365 Business Central.
The extension of the report is a bit troublesome. But Microsoft has plans to release “Report Extensions” next year. So let us wait patiently.

2020/01/27

Report extensibility

Hope this will help.
Thanks.

コメント

タイトルとURLをコピーしました