Extending pages with Document Central
Document Central can be integrated into existing pages in Business Central by extending them with both the Document Central Factbox and the Document Central action group in the action bar. This approach ensures that all core functionalities—such as document management and archiving—remain accessible, even when the Factbox is hidden due to personalization, role settings, or limited screen space. The following documentation demonstrates how to implement these elements using a page extension.
There are two ways to do this:
- In case of an own page, you can add the code directly to the page.
- With other pages 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 Document Central action group in the action bar:
Card
Show code
AL |
---|
| pageextension 5492919 "SIM_DMS PostedSalesInvoiceExt" extends "Posted Sales Invoice" //132
{
layout
{
addfirst(FactBoxes)
{
part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
{
ApplicationArea = All;
}
}
}
actions
{
addafter(Category_Category20)
{
group("SIM_DMS Dropzone Actions")
{
Caption = 'Document Central';
ShowAs = Standard;
Image = Document;
actionref("SIM_DMS Configuration Wizard Promoted"; "SIM_DMS ConfigurationWizard")
{ }
actionref("SIM_DMS Archive Promoted"; "SIM_DMS Archive")
{ }
actionref("SIM_DMS Multi Quick Upload Promoted"; "SIM_DMS Multi Quick Upload")
{ }
actionref("SIM_DMS ArchiveVersionStatus Promoted"; "SIM_DMS ArchiveVersionStatus")
{ }
actionref("SIM_DMS Configuration Promoted"; "SIM_DMS Configuration")
{ }
actionref("SIM_DMS RelatedDocument Promoted"; "SIM_DMS RelatedDocument")
{ }
actionref("SIM_DMS btnUpdate Promoted"; "SIM_DMS btnUpdate")
{ }
actionref("SIM_DMS BC Standard Migration Promoted"; "SIM_DMS BC Standard Migration")
{ }
}
}
addafter("&Invoice")
{
group("SIM_DMS Dropzone FB Actions")
{
action("SIM_DMS ConfigurationWizard")
{
ApplicationArea = All;
Caption = 'Configuration Wizard';
Ellipsis = true;
Image = Setup;
ToolTip = 'This button opens the configuration wizard which will guide you through the process of creating a setup for the factbox.';
Enabled = GlobalDMSWizardEnaBoolean;
Visible = GlobalDMSWizardVisBoolean;
trigger OnAction()
begin
GlobalCodeunitSIMDMSFunctions.ConfigWizardAction(GlobalCurrRecordRef);
end;
}
action("SIM_DMS Archive")
{
ApplicationArea = All;
Caption = 'Archive';
Ellipsis = false;
Enabled = GlobalDMSFactBoxButtonsVisBoolean;
Image = Documents;
Visible = GlobalIsUserRegisteredBoolean;
ToolTip = 'This button opens the document overview.';
trigger OnAction()
begin
if not GlobalAllowViewBoolean then
exit;
GlobalPageSIMDMSDropZoneFB.ViewDocuments(GlobalCurrRecordRef);
end;
}
action("SIM_DMS ArchiveVersionStatus")
{
ApplicationArea = All;
Caption = 'Archive Queue';
Ellipsis = false;
Enabled = GlobalDMSFactBoxButtonsVisBoolean;
Image = WorkCenterLoad;
Visible = GlobalIsUserRegisteredBoolean;
ToolTip = 'This button opens the overview of the archive prints. This page can be used to monitor the archive printouts.';
trigger OnAction()
begin
GlobalPageSIMDMSDropZoneFB.ViewDocumentVersions(GlobalCurrRecordRef);
end;
}
action("SIM_DMS Configuration")
{
ApplicationArea = All;
Caption = 'Configuration';
ToolTip = 'This button opens the mapping configuration page. The settings for the mapping can be made here.';
Image = Setup;
Visible = GlobalDMSFactBoxConfigButtonVisBoolean;
trigger OnAction()
begin
GlobalCodeunitSIMDMSFunctions.ConfigurationAction(GlobalMappingCode, GlobalCurrPageIdInteger);
end;
}
action("SIM_DMS RelatedDocument")
{
ApplicationArea = All;
Caption = 'Relation Management';
ToolTip = 'This button displays all records related to this record.';
Image = Links;
Visible = GlobalIsUserRegisteredBoolean and GlobalIsUserAdminBoolean;
trigger OnAction()
begin
GlobalPageSIMDMSDropZoneFB.ViewDocumentRelations(GlobalCurrRecordRef);
end;
}
action("SIM_DMS btnUpdate")
{
ApplicationArea = All;
Visible = GlobalIsSharePointBoolean or GlobalIsAzureBlobStorageBoolean and GlobalIsUserRegisteredBoolean and GlobalIsUserAdminBoolean;
Caption = 'Sync Documents';
Image = Interaction;
ToolTip = 'This button will synchronize the documents with the SharePoint or Azure Blob Storage.';
trigger OnAction()
var
LocalRecordSIMCORESetup: Record "SIM_CORE Setup";
begin
GlobalCodeunitSIMDMSFunctions.SyncDocumentsAction('UPDATE_DATAGRID', LocalRecordSIMCORESetup, GlobalRecordSIMDMSModuleSetup, GlobalRecordSIMDMSUserSetup, GlobalRecordSIMDMSMappingHeader, GlobalRecordSIMDMSDocumentLibrary, GlobalCurrRecordRef);
end;
}
action("SIM_DMS BC Standard Migration")
{
ApplicationArea = All;
Caption = 'Migrate From BC';
Image = Import;
ToolTip = 'This action opens the BC Attachment Migration Wizard for the current entry.';
Visible = GlobalIsUserAdminBoolean;
Enabled = GlobalBCStandardRecordHasAttachmentsBoolean;
trigger OnAction()
var
LocalPageSIMDMSBCAttachWIZ: Page "SIM_DMS BC Attach WIZ";
begin
LocalPageSIMDMSBCAttachWIZ.SetValues(GlobalRecordSIMDMSDocumentLibrary, GlobalRecordSIMDMSMappingHeader, GlobalCurrRecordRef);
LocalPageSIMDMSBCAttachWIZ.RunModal()
end;
}
fileuploadaction("SIM_DMS Multi Quick Upload")
{
ApplicationArea = All;
Caption = 'Quick Upload';
ToolTip = 'This action allows users to quickly drop documents without having to open the archive.';
AllowedFileExtensions = '.*';
AllowMultipleFiles = true;
Image = CreateDocuments;
Enabled = GlobalWriteAccessControlBoolean;
trigger OnAction(Files: List of [FileUpload])
var
LocalJsonObject: JsonObject;
begin
LocalJsonObject := GlobalCodeunitSIMDMSMgt.FilesUploadAction(Files);
CurrPage.SIM_DMSDropZoneFB.Page.UploadFilesFromJsonData(Format(LocalJsonObject));
end;
}
}
}
}
trigger OnAfterGetCurrRecord()
begin
CurrPage.SIM_DMSDropZoneFB.Page.SetVariant(CurrPage.OBJECTID(FALSE), Rec, Rec."No.");
CurrPage.SIM_DMSDropZoneFB.Page.GetValues(
GlobalDMSWizardEnaBoolean,
GlobalDMSWizardVisBoolean,
GlobalDMSFactBoxButtonsVisBoolean,
GlobalIsUserRegisteredBoolean,
GlobalDMSFactBoxConfigButtonVisBoolean,
GlobalAllowViewBoolean,
GlobalCurrRecordRef,
GlobalDocumentCountIntegerText,
GlobalIsSharePointBoolean,
GlobalIsAzureBlobStorageBoolean,
GlobalCurrPageIdInteger,
GlobalIsUserAdminBoolean,
GlobalRecordSIMDMSDocumentLibrary,
GlobalRecordSIMDMSMappingHeader,
GlobalRecordSIMDMSUserSetup,
GlobalRecordSIMDMSModuleSetup,
GlobalMappingCode,
GlobalWriteAccessControlBoolean,
GlobalBCStandardRecordHasAttachmentsBoolean
);
end;
var
GlobalRecordSIMDMSModuleSetup: Record "SIM_DMS Module Setup";
GlobalRecordSIMDMSUserSetup: Record "SIM_DMS User Setup";
GlobalRecordSIMDMSMappingHeader: Record "SIM_DMS Mapping Header";
GlobalRecordSIMDMSDocumentLibrary: Record "SIM_DMS Document Library";
GlobalCodeunitSIMDMSMgt: Codeunit "SIM_DMS Mgt.";
GlobalCodeunitSIMDMSFunctions: Codeunit "SIM_DMS Functions";
GlobalPageSIMDMSDropZoneFB: Page "SIM_DMS DropZone FB";
GlobalCurrRecordRef: RecordRef;
GlobalCurrPageIdInteger: Integer;
GlobalMappingCode: Code[20];
GlobalBCStandardRecordHasAttachmentsBoolean: Boolean;
GlobalDMSWizardEnaBoolean: Boolean;
GlobalDMSWizardVisBoolean: Boolean;
GlobalDMSFactBoxButtonsVisBoolean: Boolean;
GlobalDMSFactBoxConfigButtonVisBoolean: Boolean;
GlobalDocumentCountIntegerText: Text;
GlobalIsUserRegisteredBoolean: Boolean;
GlobalIsUserAdminBoolean: Boolean;
GlobalWriteAccessControlBoolean: Boolean;
GlobalIsSharePointBoolean: Boolean;
GlobalIsAzureBlobStorageBoolean: Boolean;
GlobalAllowViewBoolean: Boolean;
}
|
List
Show code
AL |
---|
| pageextension 5492925 "SIM_DMS PostedSalesInvoicesExt" extends "Posted Sales Invoices" //143
{
layout
{
addfirst(FactBoxes)
{
part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
{
ApplicationArea = All;
}
}
}
actions
{
addafter(Category_Category20)
{
group("SIM_DMS Dropzone Actions")
{
Caption = 'Document Central';
ShowAs = Standard;
Image = Document;
actionref("SIM_DMS Configuration Wizard Promoted"; "SIM_DMS ConfigurationWizard")
{ }
actionref("SIM_DMS Archive Promoted"; "SIM_DMS Archive")
{ }
actionref("SIM_DMS Multi Quick Upload Promoted"; "SIM_DMS Multi Quick Upload")
{ }
actionref("SIM_DMS ArchiveVersionStatus Promoted"; "SIM_DMS ArchiveVersionStatus")
{ }
actionref("SIM_DMS Configuration Promoted"; "SIM_DMS Configuration")
{ }
actionref("SIM_DMS RelatedDocument Promoted"; "SIM_DMS RelatedDocument")
{ }
actionref("SIM_DMS btnUpdate Promoted"; "SIM_DMS btnUpdate")
{ }
actionref("SIM_DMS BC Standard Migration Promoted"; "SIM_DMS BC Standard Migration")
{ }
}
}
addafter(Correct)
{
group("SIM_DMS Dropzone FB Actions")
{
action("SIM_DMS ConfigurationWizard")
{
ApplicationArea = All;
Caption = 'Configuration Wizard';
Ellipsis = true;
Image = Setup;
ToolTip = 'This button opens the configuration wizard which will guide you through the process of creating a setup for the factbox.';
Enabled = GlobalDMSWizardEnaBoolean;
Visible = GlobalDMSWizardVisBoolean;
trigger OnAction()
begin
GlobalCodeunitSIMDMSFunctions.ConfigWizardAction(GlobalCurrRecordRef);
end;
}
action("SIM_DMS Archive")
{
ApplicationArea = All;
Caption = 'Archive';
Ellipsis = false;
Enabled = GlobalDMSFactBoxButtonsVisBoolean;
Image = Documents;
Visible = GlobalIsUserRegisteredBoolean;
ToolTip = 'This button opens the document overview.';
trigger OnAction()
begin
if not GlobalAllowViewBoolean then
exit;
GlobalPageSIMDMSDropZoneFB.ViewDocuments(GlobalCurrRecordRef);
end;
}
action("SIM_DMS ArchiveVersionStatus")
{
ApplicationArea = All;
Caption = 'Archive Queue';
Ellipsis = false;
Enabled = GlobalDMSFactBoxButtonsVisBoolean;
Image = WorkCenterLoad;
Visible = GlobalIsUserRegisteredBoolean;
ToolTip = 'This button opens the overview of the archive prints. This page can be used to monitor the archive printouts.';
trigger OnAction()
begin
GlobalPageSIMDMSDropZoneFB.ViewDocumentVersions(GlobalCurrRecordRef);
end;
}
action("SIM_DMS Configuration")
{
ApplicationArea = All;
Caption = 'Configuration';
ToolTip = 'This button opens the mapping configuration page. The settings for the mapping can be made here.';
Image = Setup;
Visible = GlobalDMSFactBoxConfigButtonVisBoolean;
trigger OnAction()
begin
GlobalCodeunitSIMDMSFunctions.ConfigurationAction(GlobalMappingCode, GlobalCurrPageIdInteger);
end;
}
action("SIM_DMS RelatedDocument")
{
ApplicationArea = All;
Caption = 'Relation Management';
ToolTip = 'This button displays all records related to this record.';
Image = Links;
Visible = GlobalIsUserRegisteredBoolean and GlobalIsUserAdminBoolean;
trigger OnAction()
begin
GlobalPageSIMDMSDropZoneFB.ViewDocumentRelations(GlobalCurrRecordRef);
end;
}
action("SIM_DMS btnUpdate")
{
ApplicationArea = All;
Visible = GlobalIsSharePointBoolean or GlobalIsAzureBlobStorageBoolean and GlobalIsUserRegisteredBoolean and GlobalIsUserAdminBoolean;
Caption = 'Sync Documents';
Image = Interaction;
ToolTip = 'This button will synchronize the documents with the SharePoint or Azure Blob Storage.';
trigger OnAction()
var
LocalRecordSIMCORESetup: Record "SIM_CORE Setup";
begin
GlobalCodeunitSIMDMSFunctions.SyncDocumentsAction('UPDATE_DATAGRID', LocalRecordSIMCORESetup, GlobalRecordSIMDMSModuleSetup, GlobalRecordSIMDMSUserSetup, GlobalRecordSIMDMSMappingHeader, GlobalRecordSIMDMSDocumentLibrary, GlobalCurrRecordRef);
end;
}
action("SIM_DMS BC Standard Migration")
{
ApplicationArea = All;
Caption = 'Migrate From BC';
Image = Import;
ToolTip = 'This action opens the BC Attachment Migration Wizard for the current entry.';
Visible = GlobalIsUserAdminBoolean;
Enabled = GlobalBCStandardRecordHasAttachmentsBoolean;
trigger OnAction()
var
LocalPageSIMDMSBCAttachWIZ: Page "SIM_DMS BC Attach WIZ";
begin
LocalPageSIMDMSBCAttachWIZ.SetValues(GlobalRecordSIMDMSDocumentLibrary, GlobalRecordSIMDMSMappingHeader, GlobalCurrRecordRef);
LocalPageSIMDMSBCAttachWIZ.RunModal()
end;
}
fileuploadaction("SIM_DMS Multi Quick Upload")
{
ApplicationArea = All;
Caption = 'Quick Upload';
ToolTip = 'This action allows users to quickly drop documents without having to open the archive.';
AllowedFileExtensions = '.*';
AllowMultipleFiles = true;
Image = CreateDocuments;
Enabled = GlobalWriteAccessControlBoolean;
trigger OnAction(Files: List of [FileUpload])
var
LocalJsonObject: JsonObject;
begin
LocalJsonObject := GlobalCodeunitSIMDMSMgt.FilesUploadAction(Files);
CurrPage.SIM_DMSDropZoneFB.Page.UploadFilesFromJsonData(Format(LocalJsonObject));
end;
}
}
}
}
trigger OnAfterGetCurrRecord()
var
LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
begin
CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
GlobalCurrRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
CurrPage.SIM_DMSDropZoneFB.Page.SetVariant(CurrPage.ObjectId(false), Rec, Rec."No.", GlobalCurrRecordRef);
CurrPage.SIM_DMSDropZoneFB.Page.GetValues(
GlobalDMSWizardEnaBoolean,
GlobalDMSWizardVisBoolean,
GlobalDMSFactBoxButtonsVisBoolean,
GlobalIsUserRegisteredBoolean,
GlobalDMSFactBoxConfigButtonVisBoolean,
GlobalAllowViewBoolean,
GlobalCurrRecordRef,
GlobalDocumentCountIntegerText,
GlobalIsSharePointBoolean,
GlobalIsAzureBlobStorageBoolean,
GlobalCurrPageIdInteger,
GlobalIsUserAdminBoolean,
GlobalRecordSIMDMSDocumentLibrary,
GlobalRecordSIMDMSMappingHeader,
GlobalRecordSIMDMSUserSetup,
GlobalRecordSIMDMSModuleSetup,
GlobalMappingCode,
GlobalWriteAccessControlBoolean,
GlobalBCStandardRecordHasAttachmentsBoolean
);
end;
var
GlobalRecordSIMDMSModuleSetup: Record "SIM_DMS Module Setup";
GlobalRecordSIMDMSUserSetup: Record "SIM_DMS User Setup";
GlobalRecordSIMDMSMappingHeader: Record "SIM_DMS Mapping Header";
GlobalRecordSIMDMSDocumentLibrary: Record "SIM_DMS Document Library";
GlobalCodeunitSIMDMSMgt: Codeunit "SIM_DMS Mgt.";
GlobalCodeunitSIMDMSFunctions: Codeunit "SIM_DMS Functions";
GlobalPageSIMDMSDropZoneFB: Page "SIM_DMS DropZone FB";
GlobalCurrRecordRef: RecordRef;
GlobalCurrPageIdInteger: Integer;
GlobalMappingCode: Code[20];
GlobalBCStandardRecordHasAttachmentsBoolean: Boolean;
GlobalDMSWizardEnaBoolean: Boolean;
GlobalDMSWizardVisBoolean: Boolean;
GlobalDMSFactBoxButtonsVisBoolean: Boolean;
GlobalDMSFactBoxConfigButtonVisBoolean: Boolean;
GlobalDocumentCountIntegerText: Text;
GlobalIsUserRegisteredBoolean: Boolean;
GlobalIsUserAdminBoolean: Boolean;
GlobalWriteAccessControlBoolean: Boolean;
GlobalIsSharePointBoolean: Boolean;
GlobalIsAzureBlobStorageBoolean: Boolean;
GlobalAllowViewBoolean: Boolean;
}
|
This code adds the Document Central Factbox and the Document Central action group to the page, ensuring that all the features of Document Central are available. It sends the reference of the selected entry to Document Central, allowing document archiving for the desired entries when a document library and mapping have been configured for the table.
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.