Ga naar inhoud

Pagina's uitbreiden met Document Central

Document Central kan worden geïntegreerd in bestaande pagina's van Business Central door deze uit te breiden met de Document Central Factbox en de Document Central actiegroep in de actiebalk. Op deze manier blijven alle kernfuncties — zoals documentbeheer en archivering — beschikbaar, zelfs wanneer de Factbox verborgen is door personalisatie, rolinstellingen of beperkte schermruimte. De volgende documentatie laat zien hoe deze uitbreidingen kunnen worden geïmplementeerd met een page extension.

Er zijn twee manieren om dit te doen:

  • In het geval van een eigen pagina, kunt u de code direct aan de pagina toevoegen.
  • Voor andere pagina's kunt u een pageextension maken die de code uitvoert.

De volgende vereisten moeten worden voldaan:

  • De Document Central-module moet gelicentieerd zijn.
  • CORE moet beschikbaar zijn als referentie in de extensie.
  • Document Central moet aanwezig zijn als referentie in de extensie.

Code voor het uitbreiden van een Business Central-pagina met de Document Central DropZone FB en de Document Central actiegroep in de actiebalk:

Kaart

Toon code
AL
pageextension 5492919 "SIM_DMS PostedSalesInvoiceExt" extends "Posted Sales Invoice" //132
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
            {
                ApplicationArea = All;
                Visible = GlobalModuleSetupActiveBoolean;
            }

        }
    }

    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")
            {
                Visible = GlobalModuleSetupActiveBoolean;
                action("SIM_DMS ConfigurationWizard")
                {
                    ApplicationArea = All;
                    Caption = 'Configuration Wizard';
                    Ellipsis = true;
                    Image = Setup;
                    ToolTip = 'Opens the configuration wizard for setting up 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 = 'Opens the document overview.';

                    trigger OnAction()
                    var
                        LocalContentTypeText: Text;
                    begin
                        if not GlobalAllowViewBoolean then
                            exit;
                        GlobalCodeunitSIMDMSFunctions.ViewDocuments(GlobalCurrRecordRef, LocalContentTypeText, GlobalRecordSIMDMSModuleSetup, GlobalMappingCode, GlobalCurrPageIdInteger, GlobalDeleteAccessControlBoolean, GlobalWriteAccessControlBoolean);
                    end;
                }
                action("SIM_DMS ArchiveVersionStatus")
                {
                    ApplicationArea = All;
                    Caption = 'Archive Queue';
                    Ellipsis = false;
                    Enabled = GlobalDMSFactBoxButtonsVisBoolean;
                    Image = WorkCenterLoad;
                    Visible = GlobalIsUserRegisteredBoolean;
                    ToolTip = 'Opens the archive printouts overview.';

                    trigger OnAction()
                    begin
                        GlobalPageSIMDMSDropZoneFB.ViewDocumentVersions(GlobalCurrRecordRef);
                    end;
                }
                action("SIM_DMS Configuration")
                {
                    ApplicationArea = All;
                    Caption = 'Configuration';
                    ToolTip = 'Opens the mapping configuration page.';
                    Image = Setup;
                    Visible = GlobalDMSFactBoxConfigButtonVisBoolean;

                    trigger OnAction()
                    begin
                        GlobalCodeunitSIMDMSFunctions.ConfigurationAction(GlobalMappingCode, GlobalCurrPageIdInteger);
                    end;
                }
                action("SIM_DMS RelatedDocument")
                {
                    ApplicationArea = All;
                    Caption = 'Relation Management';
                    ToolTip = 'Displays all related records.';
                    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 = 'Synchronizes documents with SharePoint or Azure Blob Storage.';

                    trigger OnAction()
                    begin
                        GlobalCodeunitSIMDMSFunctions.SyncDocumentsAction('UPDATE_DATAGRID', GlobalRecordSIMDMSModuleSetup, GlobalRecordSIMDMSUserSetup, GlobalRecordSIMDMSMappingHeader, GlobalRecordSIMDMSDocumentLibrary, GlobalCurrRecordRef);
                    end;
                }
                action("SIM_DMS BC Standard Migration")
                {
                    ApplicationArea = All;
                    Caption = 'Migrate From BC';
                    Image = Import;
                    ToolTip = '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 = 'Allows quick document upload without opening 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 OnOpenPage()
    var
        LocalRecordSIMDMSModuleSetup: Record "SIM_DMS Module Setup";
    begin
        if not LocalRecordSIMDMSModuleSetup.Get() then
            exit;

        GlobalModuleSetupActiveBoolean := LocalRecordSIMDMSModuleSetup."Archive Status";
    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,
        GlobalDeleteAccessControlBoolean,
        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;
        GlobalDeleteAccessControlBoolean: Boolean;
        GlobalIsSharePointBoolean: Boolean;
        GlobalIsAzureBlobStorageBoolean: Boolean;
        GlobalAllowViewBoolean: Boolean;
        GlobalModuleSetupActiveBoolean: Boolean;
}

Lijst

Toon code
AL
pageextension 5492925 "SIM_DMS PostedSalesInvoicesExt" extends "Posted Sales Invoices" //143
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_DMSDropZoneFB; "SIM_DMS DropZone FB")
            {
                ApplicationArea = All;
                Visible = GlobalModuleSetupActiveBoolean;
            }

        }
    }
    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")
            {
                Visible = GlobalModuleSetupActiveBoolean;
                action("SIM_DMS ConfigurationWizard")
                {
                    ApplicationArea = All;
                    Caption = 'Configuration Wizard';
                    Ellipsis = true;
                    Image = Setup;
                    ToolTip = 'Opens the configuration wizard for setting up 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 = 'Opens the document overview.';

                    trigger OnAction()
                    var
                        LocalContentTypeText: Text;
                    begin
                        if not GlobalAllowViewBoolean then
                            exit;
                        GlobalCodeunitSIMDMSFunctions.ViewDocuments(GlobalCurrRecordRef, LocalContentTypeText, GlobalRecordSIMDMSModuleSetup, GlobalMappingCode, GlobalCurrPageIdInteger, GlobalDeleteAccessControlBoolean, GlobalWriteAccessControlBoolean);
                    end;
                }
                action("SIM_DMS ArchiveVersionStatus")
                {
                    ApplicationArea = All;
                    Caption = 'Archive Queue';
                    Ellipsis = false;
                    Enabled = GlobalDMSFactBoxButtonsVisBoolean;
                    Image = WorkCenterLoad;
                    Visible = GlobalIsUserRegisteredBoolean;
                    ToolTip = 'Opens the archive printouts overview.';

                    trigger OnAction()
                    begin
                        GlobalPageSIMDMSDropZoneFB.ViewDocumentVersions(GlobalCurrRecordRef);
                    end;
                }
                action("SIM_DMS Configuration")
                {
                    ApplicationArea = All;
                    Caption = 'Configuration';
                    ToolTip = 'Opens the mapping configuration page.';
                    Image = Setup;
                    Visible = GlobalDMSFactBoxConfigButtonVisBoolean;

                    trigger OnAction()
                    begin
                        GlobalCodeunitSIMDMSFunctions.ConfigurationAction(GlobalMappingCode, GlobalCurrPageIdInteger);
                    end;
                }
                action("SIM_DMS RelatedDocument")
                {
                    ApplicationArea = All;
                    Caption = 'Relation Management';
                    ToolTip = 'Displays all related records.';
                    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 = 'Synchronizes documents with SharePoint or Azure Blob Storage.';

                    trigger OnAction()
                    begin
                        GlobalCodeunitSIMDMSFunctions.SyncDocumentsAction('UPDATE_DATAGRID', GlobalRecordSIMDMSModuleSetup, GlobalRecordSIMDMSUserSetup, GlobalRecordSIMDMSMappingHeader, GlobalRecordSIMDMSDocumentLibrary, GlobalCurrRecordRef);
                    end;
                }
                action("SIM_DMS BC Standard Migration")
                {
                    ApplicationArea = All;
                    Caption = 'Migrate From BC';
                    Image = Import;
                    ToolTip = '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 = 'Allows quick document upload without opening the archive.';
                    AllowedFileExtensions = '.*';
                    AllowMultipleFiles = true;
                    Image = CreateDocuments;
                    Enabled = GlobalWriteAccessControlBoolean;

                    trigger OnAction(Files: List of [FileUpload])
                    var
                        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
                        LocalRecordRef: RecordRef;
                        LocalJsonObject: JsonObject;
                    begin
                        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
                        LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
                        CurrPage.SIM_DMSDropZoneFB.Page.SetVariant(CurrPage.ObjectId(false), Rec, Rec."No.", LocalRecordRef);
                        LocalJsonObject := GlobalCodeunitSIMDMSMgt.FilesUploadAction(Files);
                        CurrPage.SIM_DMSDropZoneFB.Page.UploadFilesFromJsonData(Format(LocalJsonObject));
                    end;
                }
            }
        }
    }
    trigger OnOpenPage()
    var
        LocalRecordSIMDMSModuleSetup: Record "SIM_DMS Module Setup";
    begin
        if not LocalRecordSIMDMSModuleSetup.Get() then
            exit;

        GlobalModuleSetupActiveBoolean := LocalRecordSIMDMSModuleSetup."Archive Status";
    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,
        GlobalDeleteAccessControlBoolean,
        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;
        GlobalDeleteAccessControlBoolean: Boolean;
        GlobalIsSharePointBoolean: Boolean;
        GlobalIsAzureBlobStorageBoolean: Boolean;
        GlobalAllowViewBoolean: Boolean;
        GlobalModuleSetupActiveBoolean: Boolean;
}

Deze code voegt de Document Central Factbox toe aan de pagina, samen met de Document Central actiegroep, waardoor alle Document Central-functionaliteiten beschikbaar zijn. Het stuurt de referentie van het geselecteerde record naar Document Central, zodat documenten voor de gewenste records kunnen worden gearchiveerd wanneer een documentbibliotheek en mapping voor de tabel zijn geconfigureerd.

Info

De barcode Factbox is verplaatst naar de Document Inbound App. Ga naar het betreffende gedeelte in de documentatie om de nieuwe integratie te zien.