Skip to content

Creating and Copying Layouts

A Dynamics 365 Business Central report is made up of the following two components:

  • Report Object: A report object defines the report dataset (i.e., based on the report schema, which include the dataitems, fields/columns and parameters) and request page. Its definition is found in the code of a Dynamics 365 Business Central (AL) extension.
  • Layout: A layout defines how the report dataset should be presented when printed or exported to a file. You can use a report designer to edit the layout of a report.

If you want to design a layout for one of your document reports, then it is best to get started by creating a copy of an existing, extension-provided report layout to create a new user-defined report layout that you can edit. However, if you want to, you can also choose to create an entirely new, blank Document Creator layout for your document reports.

Creating a New LayoutLink

To create a new, report layout, you first need to have a report object that the layout will target. You can use one of the report objects from the Microsoft Base Application, use a report object from the Document Creator extension, or from any other extension.

If you have a report object, then you can create a new Document Creator report layout for the report on the Report Layouts page as follows:

Creating a New Blank LayoutLink

  1. Invoke the New Layout... action.

    new-layout-action

  2. Choose New blank layout and choose OK.

    new-layout-action-new-blank-layout

  3. Enter/Select the Report ID of the target report object.

  4. Enable Insert Document Creator Layout.
  5. Select OK.

The figure below shows the inputs on the Add New Blank Document Creator Layout dialog page to create a new, blank Document Creator layout for report 11249662 "Sales – Invoice":

new-blank-layout-dialog

After pressing "OK", a new record will have been created for report 11249662 "Sales – Invoice" with layout name "My Custom Sales Invoice Layout".

new-report-layout-record

Note that you can always choose to rename the layout using the standard Edit Info action on the Report Layouts page.

Creating a New Layout based on a Built-In LayoutLink

  1. Invoke the New Layout... action.

    new-layout-action

  2. Choose Copy from built-in layout and choose OK.

    new-layout-action-copy-from-built-in-layout

  3. Select a built-in report layout from the list to copy as a new layout.

  4. By default the Layout Name will be set to "Copy of <Original Name>". You can freely change this name. (Optional)
  5. You can also change the target report object for the new layout if you enable the Change Report (Dataset) option. If this option is enabled, you can enter/select the Report ID of the new target report object. (Optional)
  6. Select OK.

Copying a LayoutLink

To copy a layout from an existing Document Creator report layout record to a new record on the Report Layouts page, follow these steps:

  1. Select a report layout record from which to copy the layout.
  2. Invoke the Copy action.

    copy-layout-action

  3. By default the Layout Name will be set to "Copy of <Original Name>". You can freely change this name. (Optional)

  4. You can also change the target report object for the new layout if you enable the Change Report (Dataset) option. If this option is enabled, you can enter/select the Report ID of the new target report object. (Optional)
  5. Select OK.

copy-layout-dialog

A new record will have been created containing a copy of the layout of the earlier selected record.

Caution

If you enable the Change Report (Dataset) option and change the target report object, then please take into account that the schema of the report objects might be different. Therefore, the layout may not work directly, which means you will need to edit it first to make sure it matches the new schema.

Extension-Provided LayoutsLink

Caution

The information below is only relevant to Business Central (AL) extension developers. If you are not planning to develop a Business Central extension, then you can freely skip this section.

Starting from the Microsoft Dynamics 365 Business Central 2022 release wave 1 (April 1st, 2022, version 20.0) it is possible to have multiple extension-provided report layouts. This also means that you include one or more Document Creator layouts in an AL report or reportextension object in your Business Central extension.

In the report object definition or in a reportextension object it is possible to define the layouts that should be shipped with the app(s) that (collectively) define the report object that produces the dataset in a new rendering section of the object. A reportextension can add additional layouts for the report, but note that it cannot modify or remove the existing layouts provided by the original report object or other reportextension objects for the report.

Document Creator report layouts are defined as External (in AL rendering sections, this layout type is named Custom) layouts with the MimeType set to reportlayout/dcrx.

You can include a Document Creator layout for a report in your app by adding a layout section with the properties set as follows:

rendering
{
    layout("EXT - Document Creator Sales Invoice Layout - RED")
    {
        Caption = 'EXT - Document Creator Sales Invoice Layout - RED';
        LayoutFile = 'Source/Reports/Sales/EXTSalesInvoiceRed.Layout.dcrx';
        MimeType = 'reportlayout/dcrx';
        Summary = 'The EXT RED Document Creator layout for the Posted Sales Invoice';
        Type = Custom;
    }

    layout("EXT - Document Creator Sales Invoice Layout - BLUE")
    {
        Caption = 'EXT - Document Creator Sales Invoice Layout - BLUE';
        LayoutFile = 'Source/Reports/Sales/EXTSalesInvoiceBlue.Layout.dcrx';
        MimeType = 'reportlayout/dcrx';
        Summary = 'The EXT BLUE Document Creator layout for the Posted Sales Invoice';
        Type = Custom;
    }
}

When the app is installed, the newly added, extension-provided report layouts can all be found on the Report Layouts page.