Skip to content

Extending pages with the Document Central Factbox

In this documentation we will create an extension that extends a page in Business Central with the Document Central Factbox. The factbox is used to manage and store record related documents.

There are two ways to do this:

In case of an own page, you can add the code directly to the page. With other page you can create a page extension which will execute the code.

The following requirements must be met:

  • The Document Central module must be licensed.
  • CORE must be available in the extension as a reference.
  • Document Central must be present in the extension as a reference.

Code for the extension of a Business Central Page with The Document Central DropZone FB and the Barcode Return FB:

Card

AL
pageextension 5492919 "SIM_DMS PostedSalesInvoiceExt" extends "Posted Sales Invoice"
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
            {
                ApplicationArea = All;
            }
        }
    }
    var
        GlobalBarcodeVisibleBoolean: Boolean;

    trigger OnAfterGetCurrRecord()
    begin
        CurrPage.SIM_DMSDropZoneFB.Page.SetVariant(CurrPage.OBJECTID(FALSE), Rec, Rec."No.");
        CurrPage.SIM_DMSBarcodeReturnFB.Page.SetVariant(CurrPage.OBJECTID(FALSE), Rec, Rec."No.");
        GlobalBarcodeVisibleBoolean := CurrPage.SIM_DMSBarcodeReturnFB.Page.GetVisible();
    end;
}

List

AL
pageextension 5492919 "SIM_DMS PostedSalesInvoiceExt" extends "Posted Sales Invoices"
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
            {
                ApplicationArea = All;
            }
        }
    }
    var
        GlobalBarcodeVisibleBoolean: Boolean;

    trigger OnAfterGetCurrRecord()
    var
        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
        LocalRecordRef: RecordRef;
    begin
        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
        LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
        CurrPage.SIM_DMSDropZoneFB.Page.SetVariant(CurrPage.OBJECTID(FALSE), Rec, Rec."No.", LocalRecordRef);
        CurrPage.SIM_DMSBarcodeReturnFB.Page.SetVariant(CurrPage.OBJECTID(FALSE), Rec, Rec."No.");
        GlobalBarcodeVisibleBoolean := CurrPage.SIM_DMSBarcodeReturnFB.Page.GetVisible();
    end;
}

Info

The Barcode factbox has been moved to the Document Inbound App. Please move to the respective area in the documentation to see the new integration.

This code adds the Document Central factbox to the page which sends the reference of the selected entry to Document Central. This allows the archiving of documents for the desired entries in the repository when a document library and mapping has been configured for the table.