Dynamics 365 Business Central: Don’t Forget the Layout! Essential Steps for Publishing Report Extensions

Dynamics 365 Business Central

Hi, Readers.
Today, I’d like to share how to manage layout files directly in your source code when publishing Report Extensions. No more manual uploads in the BC client—let’s keep everything in your project for a smoother workflow.

With the report extension object, you can extend existing report objects, similar to how you extend tables and pages. With report extensions, you can extend an existing report by:

  • Adding columns to existing data items in the report dataset
  • Adding new data items
  • Adding trigger implementations
  • Adding to request pages
  • Adding more report layouts, either to reflect new fields that are added with an extension, or simply adding new report layouts on an existing report dataset.

We have previously discussed some Report Extension Examples & Use Cases, more details: Dynamics 365 Business Central Blog Series: Report Extension Examples & Use Cases

Recently, I’ve noticed a common issue where some developers manually upload their layout files for Report Extensions instead of including them in the source code. They would deploy the application first, download the layout file, modify it, and then manually upload it back. The layouts are managed completely separately from the code.

While this approach is certainly feasible, it is far from the best solution. In fact, from Business Central 2022 wave 1 (BC20), the rendering section within the AL object allows you to specify multiple named layouts in the object and you specify the default layout by name and not by type. More details: Adding multiple layouts (New rendering section for report and report extensions)

Note: The rendering syntax is the recommended syntax to use.

Let’s look at an example, taking the one mentioned in the blog below as a reference.
How to add Media or MediaSet data type (Pictures) to a report

I have created a ‘Layouts’ folder to store the layout files.

Then, specify the layout file in the rendering section of the Report Extension (if you ignore the folder, the file will be saved in the root directory).

Then, after publishing the extension, you can directly find the layout files set in the report extension on the Report Layouts page, and you can also see which extension it belongs to in the Extension column.

PS: If you create it directly on the Report Layouts page, the Extension column will be empty, and if you update the code, you would need to manually upload it again—it won’t be automatically published along with the extension.

Very simple, give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL