Business Central: Modifying Reports

One of the things you notice when getting started with Business Central extensions is the sample first App walk-through includes Table Extensions and Page Extensions. It does not include extensions for reports. Likewise, the documentation for reports does not include a report extension object. There’s a good reason for this: report extensions don’t exist, at least as of the October 2019 Wave 2 Release. It has been added to the request list by several.

So what if you need to add something to a report? I’d suggest this approach.

If the data you want to add to the report is standard Business Central data such as the External Document Number, start with this first approach. If the data you want to add is not standard Business Central data, for example if it comes from a table extensions that you created, go directly to the second approach.

First Approach To Report Customization

First, go to Report Layouts in Business Central; select the report you want to update. Also notice whether the default report is Word or RDLC. Now choose Process > Custom Layouts. You will see the screen below.

On the Custom Layouts page, select New, then click the New… menu item. This report is an RDLC layout, so select the RDLC layout as shown.

Copying a Business Central Report built-in layout.

Press OK, and you will see a list view, with report 9 added. On this list view, select the report, then select Layout > Export Layout. This will export the RDLC layout, which you can open with Microsoft Report Builder.

If you do not have this loaded on your system already, you can download it from the Microsoft website.

On the left-hand side of the report, expand the dataset until you can see column names. Look through these column names to see if the data you want to add to the report is present. Examining an RDLC report's dataset in Microsoft Report Builder.Note that as I mentioned above, if you have added data to Business Central, it will not be shown here. If you find the field that you are trying to add, use Microsoft report builder to add it.

Once you have made the modification, go back into Business Central. On the Custom Report Layouts Page, choose Layout > Import. Once you have done this, choose Update Layout from the same layout menu. You should now be able to run the report with the new layout. This is also the method that you would use to change fonts or other styles in a report.

Business Central Report Modification When Easy Does Not Work

If this method does not work because you are trying to add data to report that is not on the dataset list, will have to use the VS Code development environment configured for AL as described here.

If you are using Business Central 14 or Dynamics NAV 2018, you will need to export the report object from the database and convert it to AL. That process is described here.

If you are using Business Central 15 (October 2019, Wave 2), take a look at the on-premise installation ISO. In the Application directory, you will find the code for the BaseApp reports in the BaseApp directory. There are also some other interesting source files in this directory.

To find the report we have been working on, you will need to unzip the BaseApp source code and find the report file which in this case is called If you copy this into your own AL project (recommended), you will also want the report layout file TrialBalanceBudget.rdlc. You will have to change both the name and the report number, and I recommend that you change the caption (in the AL file) to reflect the fact that the report has been customized.

Applying the New Report In Business Central

You can use this technique of copying and changing the source code for any report in the base application. Then publish these as extensions, and use Page Extensions to place them on any pages where the reports appear. To find these pages, you can open the full AL BaseApp code in the development environment and do a text search. Of course, the most common things will be changing are probably things like Sales Orders and Purchase Orders, and these can simply be changed on the report selection set up for the appropriate module.

Let us know if we can help you with this, and have fun customizing Business Central.





Upgrading Microsoft Dynamics Business Central

Microsoft Dynamics NAV has been renamed Microsoft Dynamics Business Central. Along with the name change, there are several significant changes in the software. One of the most significant is the elimination of the C/SIDE development environment and the C/AL language as of the October 2019 Wave 2 Release. These have been replaced by the Modern Development Environment, which uses VSCode, and the AL language.

How Dynamics NAV Customizations Work

Through Microsoft Dynamics NAV 2017, changes were made inside the existing program. Microsoft Dynamics NAV 2018 and following use the concept of extensions. An extension is an add-on to the existing program which adds features without requiring changes to the program code. You might think of the old method as being “inside” the program code, and the new method as being “outside” the program code.

From a practical point of view, this means that once code is converted from the old method to an extension, upgrades become more straightforward. Since they are located in one or more “projects,” they can be tested quickly against a new version. And since they use triggers or events, they are compatible with future releases as long as Microsoft does not make changes to these “hooks.”

As Microsoft makes changes to Business Central, it may still be necessary to update the extension. However, it will not be necessary to extract changes from the program code and then merge them back into new program code.

Migrating Custom Code from Prior Versions

Microsoft has provided a number of tools to assist in migration. These include tools to convert C/AL code to AL code, and tools to create extensions from the changes made in prior versions (called Delta code). The newest version includes tools to migrate a custom database to the new format without having to write code.

In some situations, customization will translate to the new version with very little re-coding. In other cases, the technique used may have been eliminated and more extensive changes may be required. In all cases, some preliminary evaluation of your database will help a developer determine how to proceed.

Options for Upgrades

Until October 2020, existing Business Central / NAV users will have access to the Windows Client. This was called the “role-tailored client”) from 2009 forward. It has been eliminated for releases after the April 2019, but existing users can license it through 10/1/2020. Since this version supports C/SIDE, it is possible to move to it without converting code to AL. But that is just delaying the inevitable.

If you want to maintain the Windows Client look and feel, however, it may be a good option to move to the April 2019 release (14) while converting the code and database to AL.

The basic evaluation process extracts your customization to DELTA files, then converts the DELTA files to AL code and uses VSCode to evaluate the result. To do this, convert your base, unmodified current version and your modified version to 2018 or 2019 April release. This isn’t a full conversion, it just involves opening the databases with the new C/SIDE development tool.

Once they are converted, follow the instructions here to produce the AL code. A few technical notes: (1) the objects need to compile in the new version in order to export correctly, (2) You need the -ExportToNewSyntax in order to use the txt2al tool that produces the AL files, and (3) if you did not customize the object, it does not need to compile.

Things To Watch For

The Txt2Al tool does a fair job in that it will save you time. However, particularly when converting older reports, you will get files with errors. Watch particularly for the “Ambiguous reference,” error. Many of these seem to be produced by the fact that the Txt2Al tool sometimes does not surround fields with double quotes.

For example, the field Document No., needs to be written “Document No.” The conversion tool often omits this punctuation, which gives errors in VSCode: not just in the places the quotes are needed, but in other code that is not in error. Start at the top of the converted file and correct obvious errors; skip items that do not seem to be errors until you reach the bottom. Then begin another pass with the same heuristic. Doing this–particularly with reports–often caused errors that were not really errors to disappear. That is particularly the case with the “Ambiguous reference” error.

Good coding, and let me know how it comes out for you!