Dynamics 365 Business Central: automatically import custom report layouts with extensions

Do you love reports? Personally, NO! 🙂 But that is, as a Business Central developer I think that sometimes (forced or not) you need to work with reports in your solutions.

As a quick recap, in Dynamics 365 Business Central a report layout controls content and format of the report, including which data fields of a report dataset appear on the report and how they are arranged, text style, images, and more. From Business Central, you can change which layout is used on a report, create new layout, or modify the existing layouts. A report can be set up with multiple report layouts, which you can switch among as required. You can use one of the built-in report layouts or you can create custom report layouts and assign them to your reports as needed. By default, a report will have a built-in report layout, which can be either an RDLC report layout or Word report layout, or both. You cannot modify built-in layouts. However, you can create your own custom layouts that enable you to change the appearance of report when it is viewed, printed or saved. 

One of the request received some days ago was if Microsoft supports a way to automatically import custom report layouts with an extension (so without manual installation, but automatically during an extension’s installation).

The answer is that there’s not an official solution for this (the official response is “upload them manually”, but there’s also an undocumented trick that could help you.

You can automate the process of importing custom report layouts with an extension by doing the following:

  1. Export your custom report layout from the development machine with the Export-NAVAppReportLayout Powershell cmdlet. This created a .layoutdata file.
  2. Add the .layoutdata file to your AL project

NOTE: you need to create a single .layoutdata for each layout that you want to import.

When published, the extension automatically imports your custom layouts to the Custom Report Layout table (flagged as Built-in):

This will do your work, but please remember that you need to have the corresponding Report Layout for this report ID or you can have problems (error for no matching report id in Report Layout table).

A piece of code that fixes this problem is to add in the Install codeunit of your extension (OnInstallAppPerDatabase trigger) and in the Upgrade codeunit of your extension (OnUpgradePerDatabase trigger ) the following code:

Please remember that this is not officialy supported, but this is only a trick. Use at your own risk 🙂


  1. Hi Stefano, How do i get the layoutdata file if working on online sandbox? Or how can I get an example of this file?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.