web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Adding a custom field to Sales Header in report 1306.

(0) ShareShare
ReportReport
Posted on by 74

Hi All,

I am new to this, so please bear with me if I have not mentioned all the information needed to get proper help. I have built a table extension that adds two custom fields to the company information table in business central. Then I added these field to a page through the page extension. The last step for me would be to add these fields to the report dataset of the sales Invoice report 1306. My work so far has the added fields present in the report dataset. The only problem seems to be that the fields, which do have a value, do not show the value.

Important Notes on what I have already looked at:

I have seen that report 1306 uses a procedure on the report Init() trigger. 

CompanyInfo.Get()

pastedimage1679330261079v7.png

Furthermore, any fields in the header are being populated by a procedure. The table header has been split into two dataItems (LeftHeader & RightHeader). I am guessing I have to subscribe to the right trigger to add my two custom fields being populated. I however, cannot seem to figure out what trigger or triggers I need to use to add my two custom fields. 

pastedimage1679330066171v2.png

This goes back to the FillLeftHeader() Procedure

 pastedimage1679330185259v6.png

The code I wrote is below:

Table Extension

tableextension 50100 CribNoExt extends "Company Information"
{

    fields
    {
        // Add changes to table fields here
        field(101; Company_Crib_No; Text[20])
        {
            Caption = 'Crib No.';
        }
        field(102; Company_Kvk_No; Text[20])
        {
            Caption = 'Kvk No.';
        }
        field(103; "Bank Name 2"; Text[20])
        {
            Caption = 'Bank Name 2';
        }
        field(104; "Bank Account No 2"; Text[20])
        {
            Caption = 'Bank Account No 2';
        }
    }

    var
        myInt: Integer;
}
 

Page extension:

pageextension 50102 CribNoPage extends "Company Information"
{
    layout
    {
        // Add changes to page layout here
        addafter("Industrial Classification")
        {
            field(CribNo; Rec.Company_Crib_No)
            {
                ApplicationArea = all;
            }
            field(KvkNo; Rec.Company_Kvk_No)
            {
                ApplicationArea = all;
            }
        }

        addafter("Bank Account No.")
        {
            field("Bank Name 2"; Rec."Bank Name 2")
            {
                ApplicationArea = all;
            }
            field("Bank Account No 2"; Rec."Bank Account No 2")
            {
                ApplicationArea = all;
            }
        }
    }

    actions
    {
        // Add changes to page actions here
    }

    var
        myInt: Integer;
}

Report Extension:

reportextension 50103 CribNoKvK extends "Standard Sales - Invoice"
{

    dataset
    {
        // Add changes to dataitems and columns here

        add(Header)
        {
            column(Company_Crib_No; companyInfoExt.Company_Crib_No) { }
            column(Company_Kvk_No; companyInfoExt.Company_Kvk_No) { }
        }

    }
    
    Var
        myInt: Integer;
        myCribNo: text[20];
    
        companyInfoExt: Record "Company Information";
        company_crib_no_lbl: Label 'Crib No';
        company_kvk_no_lbl: Label 'Kvk No';

}

IN conclusion I want to know is this possible? and if not is the only other solution to create a completely new report? This is quite a complex report to just copy and then edit. I would rather extend it. 

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    You need to run  a get on your CompanyInfoExt variable in a on pre report trigger as described here.

    Try to add that trigger to your report and do a CompanyInfoExt.Get() within that trigger.

    You can do this in a learn.microsoft.com/.../devenv-onprereport-report-trigger

  • Zafar LIT Profile Picture
    74 on at

    Hi NorthW ,

    Thank for the reply. I will try this and circle back if that worker for me.

  • Zafar LIT Profile Picture
    74 on at

    NorthW It worked!

    Do you have a reference for me for the .get() function? I did not get that the .Get() (method or function) is a standard function of some sort. Which made it a lot more complicated for me to figure out.

    In any case this is the solution to my problem! Thank yo very much!

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    Maybe this is helpful ?

    learn.microsoft.com/.../devenv-get-find-and-next-methods

    Normally when you use the Get method you will add parameters for the primary key of the record you want to get.

    But if you use Get.() with no parameteres the function will get the first record in the table. And because there are only one record in the companyinformation table the get.() with out parameteres will work fine here.

  • Zafar LIT Profile Picture
    74 on at

    Thank you NorthW for the explanation and reference!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 545 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 354 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 228 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans