Skip to content

Custom Fields on Reports

You can use your custom fields on your own reports and layouts.

In this section you will learn more about how to make the fields available for your reports so that you can add them to your report layouts.

Using Apportunix Document Creator Dataset Extensions

When you are using Apportunix Document Creator to edit report layouts, then you can easily add custom fields using Document Creator's Dataset Extensions functionality. This functionality allows you to add any field to your reports' datasets to use them in your Document Creator report layouts, directly from the Business Central client, without any need for developing additional custom Business Central extensions to achieve this.

Dataset Extensions Example

Success

Using the Apportunix Document Creator - Dataset Extensions functionality, you can add both Normal and Calculated custom fields to your report objects.

The Select Custom Fields action is available with Apportunix Document Creator version 2.116.0.0.

To add an Apportunix Custom Fields field to your report object via the Dataset Extensions functionality, please follow these steps:

  1. Use the Tell Me search feature (Alt+Q, or click on the ‑icon in the top right corner) to search for and open up the Document Creator Report Dataset Extensions page.

    Tell Me Dataset Extensions page

  2. Select a report object to add the custom fields to, e.g., report object 11249662 "Sales - Invoice":

    Dataset Extensions - Select Report (1)

    Dataset Extensions - Select Report (2)

  3. Click on the Custom Columns action to open the Custom Report Columns page that you can use to add additional fields as report columns to the report object.

    Dataset Extensions - Custom Columns Action

  4. Click on the Select Custom Fields... action to start adding custom fields as custom report columns to the report object.

    Dataset Extensions - Select Custom Fields Action

    Note

    The Select Custom Fields action is available in Apportunix Document Creator version 2.116.0.0

  5. On the Select Parent Data Item and Table page that opens select a data item to add the new column(s) to and a table to retrieve the field value from.

    For our example, let's say we would like to add custom fields from the Sell-to Customer. As customer fields are header details, we will be adding the fields as columns of the InvHdr (Sales Invoice Header) dataitem. As the table, we will be selecting the Customer table.

    Dataset Extensions - Select Custom Fields Data Item and Table

    Click on OK.

  6. A page opens that shows all Apportunix Custom Fields custom-defined fields for the table.

    Select the field(s) that you would like to add as columns to the report object and click OK.

    Dataset Extensions - Select Custom Fields Field Selection

  7. For each of the selected fields a new custom report column record will have been added:

    Dataset Extensions - Custom Fields Added

    The final thing we need to do is create/select a Filter Set for each of the records to specify that we want to take the field values from the Sell-to Customer of the posted sales invoice (and not from the bill-to customer or another customer).

    Click on the Filter Set cell for a record and choose New:

    Dataset Extensions - Create Filter Set for Custom Column

  8. Configure the new Filter Set.

    For our example, we are going to put a filter on field 1 "No." of the Customer table and we are going to filter it on the SelltoCustNo column value that is already in the report dataset:

    Dataset Extensions - Create Filter Set for Custom Column (2)

    Give the filter set a proper Description (e.g. "Sell-to Customer of Invoice") so that it is easy to distinguish its purpose when you want to reuse the filter set for other columns of the report object.

  9. Reuse the Filter Set for other records, or create another one with the appropriate filters for the other columns (e.g., when you want to retrieve the value from the bill-to customer instead of the sell-to customer for the other custom columns).

    Dataset Extensions - Reuse Filter Set

  10. When you are finished adding your custom-defined fields as new custom report columns, use the Apportunix Document Creator designer to add your custom fields to your report layout(s).

    You can find more about Editing Layouts using the Document Creator Designer in the online user manual.

Using Report Extensions

When you would like to add fields as new columns to existing or custom report objects in Business Central without using Apportunix Document Creator, then this is also possible.

In this section you will learn how to do this, first by determining which field to add, and next by adding the field via custom AL extension code in a report or reportextension object.

Determine which Table Field to Use

Please note that the Custom Fields have a dynamic caption, which is displayed when you view the fields on pages in Business Central. However, when you need to use the fields as columns in reports and their corresponding layouts, then you will need to determine the table field name to use.

The table field names of Custom Fields follow the following format:

"WSB <Type> <Field No.>"

where:

  • <Type> - Refers to the type of the custom field, which can be one of the following:
    • Checkbox (Boolean)
    • Code
    • Date
    • Decimal
    • Number (Integer)
    • Text
  • <Field No.> - Refers to the custom field number, which can be a value from 1 to 10.

Let's take the example where we have a custom field that is defined as follows:

  • Entity = Sales Header
  • Type = Code
  • Field No. = 1

Custom Fields on Reports Example 1

Then, the name of the table field will be WSB Code 1, which we can confirm by opening the Page Inspector (Ctrl+Alt+F1) on the Sales Order page:

Custom Fields on Reports Example 2

Add Custom Fields as Report Columns

If you are using the standard report (editor) of Business Central you will need to develop a reportextension object in a Business Central extension for the report object where you would like to use the custom field as a new column.

  1. Add the Custom Fields app as a dependency to the app.json manifest file of your own Business Central extension (e.g., a Per-Tenant Extension (PTE) containing customizations for your environment).
  2. After this, the fields can be accessed and added to your custom report object, or to an existing report using a reportextension object, as a new report column, e.g.:

    column(PremiumLevel_SalesHdr; "WSB Code 1") { }
    

    Please note that the field values of custom calculated fields are not stored in a table field. If you would like to use a calculated field value for columns in your report objects, then you will need to use codeunit WSB_CFCalculateCustomField to calculate a result that you can use, e.g.:

    column(AverageSalesLCY_Customer; AverageSalesLCY) { }
    
    // ...
    
    trigger OnAfterGetRecord()
    var
        CalculateCustomField: Codeunit WSB_CFCalculateCustomField;
        CalculationSuccessful: Boolean;
        CustomFieldNo: Integer;
    begin
        CustomFieldNo := 2;
        CalculationSuccessful := CalculateCustomField.wgFncCalculateCustomFieldDecimalValue(Customer, CustomFieldNo, AverageSalesLCY);
    end;
    
    // ...
    
    var
        AverageSalesLCY: Decimal;
    

    Please see the "Report Extension Object" section of the Microsoft Dynamics 365 Business Central documentation for more information on how to extend report objects.

Alternatively, you can use the Dataset Extensions feature of the Apportunix Document Creator extension, which allows you to add any field to your reports' datasets to use them in your Document Creator report layouts, directly from the Business Central client, without any need for creating additional Business Central extensions for this.

Dataset Extensions Example


Last update: October 20, 2025