Zum Inhalt

Erweiterung von Seiten mit der Document Dispatch Factbox

In dieser Dokumentation wird beschrieben, wie eine Seite in Business Central mit der Document Dispatch Factbox erweitert wird. Die Factbox dient dazu, sich einen Überblick über die eingerichteten Unterpunkte, wie z. B. die Verfügbarkeit von Versandoptionen, zu verschaffen sowie um Dokumente bei richtiger Einrichtung direkt zu versenden.

Eine vollständige Seitenerweiterung für Document Dispatch besteht aus zwei Teilen:

  1. Layout – Die Factbox (SIM_EDS FB) wird dem FactBoxes-Bereich der Seite hinzugefügt.
  2. Actions – Die Document Dispatch-Aktionen (z. B. Senden, Herunterladen, Zeitplan) werden als Aktionsgruppe in das Menüband der Seite integriert.

Ab Version 25 wurden zusätzliche Aktionen eingeführt, die in BC24 noch nicht vorhanden sind. Die Code-Beispiele sind daher nach Version unterteilt.

Es gibt zwei Möglichkeiten, die Erweiterung einzubinden:

  1. Falls Sie eine eigene Seite verwenden, können Sie den Code direkt auf der Seite hinzufügen.
  2. Falls Sie bestehende Seiten erweitern möchten, können Sie eine Seitenerweiterung erstellen, die den Code ausführt.

Voraussetzungen

Die folgenden Anforderungen müssen erfüllt sein:

  • Das Document Dispatch Modul muss lizenziert sein.
  • CORE muss in der Erweiterung als Referenz verfügbar sein.
  • Document Dispatch muss in der Erweiterung als Referenz vorhanden sein.

Erweiterung einer Business Central-Seite mit der Document Dispatch Factbox

Karte
- Für Document Dispatch ab BC24
pageextension 5487161 "SIM_EDS PostedSalesInvoiceExt" extends "Posted Sales Invoice" //132
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_EDSFB; "SIM_EDS FB")
            {
                ApplicationArea = All;
            }
        }
    }
    actions
    {
        addafter(Category_Category13)
        {
            group(SIM_EDS_Actions_Promoted)
            {
                Caption = 'Document Dispatch';
                ShowAs = Standard;
                Image = SendTo;
                Visible = GlobalIsUserRegisteredBoolean;

                actionref(SIM_EDS_FB_Send_Promoted; SIM_EDS_FB_Send) { }
                actionref(SIM_EDS_FB_SendDialog_Promoted; SIM_EDS_FB_SendDialog) { }
                actionref(SIM_EDS_FB_DownloadAction_Promoted; SIM_EDS_FB_DownloadAction) { }
                actionref(SIM_EDS_FB_Schedule_Promoted; SIM_EDS_FB_Schedule) { }
                actionref(SIM_EDS_FB_Cancel_Promoted; SIM_EDS_FB_Cancel) { }
                actionref(SIM_EDS_FB_OneDrive_Promoted; SIM_EDS_FB_OneDrive) { }
                actionref(SIM_EDS_FB_SetupBP_Promoted; SIM_EDS_FB_SetupBP) { }
                actionref(SIM_EDS_FB_ConfigureBP_Promoted; SIM_EDS_FB_ConfigureBP) { }
            }
        }
        addafter("&Navigate")
        {
            group(SIM_EDS_FB_Actions)
            {
                Caption = 'Document Dispatch';
                Visible = GlobalIsUserRegisteredBoolean;

                action(SIM_EDS_FB_Send)
                {
                    Caption = 'Send';
                    ToolTip = 'Send the pre-configured documents to the business partner for the current entry.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalMultipleOutputTypesExistsBoolean;

                    trigger OnAction()
                    var
                        LocalCodeunitSIMEDSQueueMgt: Codeunit "SIM_EDS Queue Mgt";
                        LocalRecordRef: RecordRef;
                    begin
                        LocalRecordRef.GetTable(Rec);
                        LocalCodeunitSIMEDSQueueMgt.SendEDS(LocalRecordRef, true, false, '');
                        LocalRecordRef.Close();
                        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);
                    end;
                }
                action(SIM_EDS_FB_SendDialog)
                {
                    Caption = 'Send Dialog';
                    ToolTip = 'Edit or personalize the email before sending it to the business partner.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalMultipleOutputTypesExistsBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SendDialog();
                    end;
                }
                action(SIM_EDS_FB_DownloadAction)
                {
                    Caption = 'Download';
                    ToolTip = 'Download the pre-configured documents to the Document Dispatch business partner that have the output type "Download" for the current entry.';
                    Image = Download;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSelectedContainsDownloadBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Download();
                    end;
                }
                action(SIM_EDS_FB_Schedule)
                {
                    Caption = 'Schedule';
                    ToolTip = 'Open the settings for scheduled dispatch for the current entry.';
                    Image = ChangeDate;
                    ApplicationArea = All;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ScheduleWizard();
                    end;
                }
                action(SIM_EDS_FB_Cancel)
                {
                    Caption = 'Cancel';
                    ToolTip = 'Cancel the dispatch for the current entry. If the dispatch is set to scheduled or delayed dispatch and the dispatch has not yet been executed, cancel the dispatch.';
                    Image = Cancel;
                    ApplicationArea = All;
                    Visible = GlobalCancelVisibleBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Cancel();
                    end;
                }
                action(SIM_EDS_FB_OneDrive)
                {
                    Caption = 'Share through OneDrive';
                    ToolTip = 'Share the current record through a OneDrive link.';
                    Ellipsis = true;
                    Image = Share;
                    Visible = GlobalSelectedContainsDownloadBoolean;
                    ApplicationArea = All;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.OneDriveShare('Posted Sales Invoice');
                    end;
                }
                action(SIM_EDS_FB_SetupBP)
                {
                    ApplicationArea = All;
                    Caption = 'Set up Business Partner';
                    ToolTip = 'Open the wizard to set up this Document Dispatch business partner for electronic dispatch, if the business partner is not activated yet.';
                    Image = SalesPerson;
                    Visible = GlobalBusinessPartnerSetupVisibleBoolean;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SetupBusinessPartner();
                    end;
                }
                action(SIM_EDS_FB_ConfigureBP)
                {
                    ApplicationArea = All;
                    Caption = 'View/Configure Business Partner';
                    Image = EditCustomer;
                    Visible = GlobalIsBPConfigurationActiveBoolean;
                    ToolTip = 'If there is an Document Dispatch business partner setup, the Document Dispatch business partner setup page will be opened.';

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ConfigureBusinessPartner();
                    end;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        GlobalIsUserRegisteredBoolean := CurrPage.SIM_EDSFB.Page.IsUserRegistered();
    end;

    trigger OnAfterGetCurrRecord()
    var
        LocalRecordSIMEDSSetup: Record "SIM_EDS Setup";
        LocalCodeunitSIMCOREMgt: Codeunit "SIM_CORE Mgt";
    begin
        if not LocalCodeunitSIMCOREMgt.CheckPermissions(UserSecurityId(), 'SIM_EDS USER | SIM_EDS ADMIN | SUPER') then exit;
        if not LocalRecordSIMEDSSetup.Get() then exit;
        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);

        GlobalMultipleOutputTypesExistsBoolean := CurrPage.SIM_EDSFB.Page.HasMultipleOutputTypes();
        GlobalSelectedContainsDownloadBoolean := CurrPage.SIM_EDSFB.Page.HasDownload();
        GlobalCancelVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsCancelVisible();
        GlobalBusinessPartnerSetupVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsBusinessPartnerSetupVisible();
        GlobalIsBPConfigurationActiveBoolean := CurrPage.SIM_EDSFB.Page.IsBPConfigurationActive();
    end;

    var
        GlobalSelectedContainsDownloadBoolean: Boolean;
        GlobalIsUserRegisteredBoolean: Boolean;
        GlobalMultipleOutputTypesExistsBoolean: Boolean;
        GlobalCancelVisibleBoolean: Boolean;
        GlobalBusinessPartnerSetupVisibleBoolean: Boolean;
        GlobalIsBPConfigurationActiveBoolean: Boolean;
}
- Für Document Dispatch ab BC25 und aufwärts
pageextension 5487161 "SIM_EDS PostedSalesInvoiceExt" extends "Posted Sales Invoice" //132
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_EDSFB; "SIM_EDS FB")
            {
                ApplicationArea = All;
            }
        }
    }
    actions
    {
        addafter(Category_Category13)
        {
            group(SIM_EDS_Actions_Promoted)
            {
                Caption = 'Document Dispatch';
                ShowAs = Standard;
                Image = SendTo;
                Visible = GlobalIsUserRegisteredBoolean;

                actionref(SIM_EDS_FB_Send_Promoted; SIM_EDS_FB_Send) { }
                actionref(SIM_EDS_FB_SendDialog_Promoted; SIM_EDS_FB_SendDialog) { }
                actionref(SIM_EDS_FB_DownloadAction_Promoted; SIM_EDS_FB_DownloadAction) { }
                actionref(SIM_EDS_FB_AddToPrintList_Promoted; SIM_EDS_FB_AddToPrintList) { }
                actionref(SIM_EDS_FB_Schedule_Promoted; SIM_EDS_FB_Schedule) { }
                actionref(SIM_EDS_FB_Cancel_Promoted; SIM_EDS_FB_Cancel) { }
                actionref(SIM_EDS_FB_OneDrive_Promoted; SIM_EDS_FB_OneDrive) { }
                actionref(SIM_EDS_FB_SetupBP_Promoted; SIM_EDS_FB_SetupBP) { }
                actionref(SIM_EDS_FB_ConfigureBP_Promoted; SIM_EDS_FB_ConfigureBP) { }
            }
        }
        addafter("&Navigate")
        {
            group(SIM_EDS_FB_Actions)
            {
                Caption = 'Document Dispatch';
                Visible = GlobalIsUserRegisteredBoolean;

                action(SIM_EDS_FB_Send)
                {
                    Caption = 'Send';
                    ToolTip = 'Send the pre-configured documents to the business partner for the current entry.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalMultipleOutputTypesExistsBoolean or GlobalIsEPostBoolean;

                    trigger OnAction()
                    var
                        LocalCodeunitSIMEDSQueueMgt: Codeunit "SIM_EDS Queue Mgt";
                        LocalRecordRef: RecordRef;
                    begin
                        LocalRecordRef.GetTable(Rec);
                        LocalCodeunitSIMEDSQueueMgt.SendEDS(LocalRecordRef, true, false, '');
                        LocalRecordRef.Close();
                        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);
                    end;
                }
                action(SIM_EDS_FB_SendDialog)
                {
                    Caption = 'Send Dialog';
                    ToolTip = 'Edit or personalize the email before sending it to the business partner.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalMultipleOutputTypesExistsBoolean or GlobalIsEPostBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SendDialog();
                    end;
                }
                action(SIM_EDS_FB_DownloadAction)
                {
                    Caption = 'Download';
                    ToolTip = 'Download the pre-configured documents to the Document Dispatch business partner that have the output type "Download" for the current entry.';
                    Image = Download;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSelectedContainsDownloadBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Download();
                    end;
                }
                action(SIM_EDS_FB_AddToPrintList)
                {
                    Caption = 'Add to Print List';
                    ToolTip = 'Add the current entry to the Print List for batch printing or merging.';
                    Image = Print;
                    ApplicationArea = All;
                    Visible = GlobalIsPrintListBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.AddToPrintList();
                    end;
                }
                action(SIM_EDS_FB_Schedule)
                {
                    Caption = 'Schedule';
                    ToolTip = 'Open the settings for scheduled dispatch for the current entry.';
                    Image = ChangeDate;
                    ApplicationArea = All;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ScheduleWizard();
                    end;
                }
                action(SIM_EDS_FB_Cancel)
                {
                    Caption = 'Cancel';
                    ToolTip = 'Cancel the dispatch for the current entry. If the dispatch is set to scheduled or delayed dispatch and the dispatch has not yet been executed, cancel the dispatch.';
                    Image = Cancel;
                    ApplicationArea = All;
                    Visible = GlobalCancelVisibleBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Cancel();
                    end;
                }
                action(SIM_EDS_FB_OneDrive)
                {
                    Caption = 'Share through OneDrive';
                    ToolTip = 'Share the current record through a OneDrive link.';
                    Ellipsis = true;
                    Image = Share;
                    Visible = GlobalSelectedContainsDownloadBoolean;
                    ApplicationArea = All;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.OneDriveShare('Posted Sales Invoice');
                    end;
                }
                action(SIM_EDS_FB_SetupBP)
                {
                    ApplicationArea = All;
                    Caption = 'Set up Business Partner';
                    ToolTip = 'Open the wizard to set up this Document Dispatch business partner for electronic dispatch, if the business partner is not activated yet.';
                    Image = SalesPerson;
                    Visible = GlobalBusinessPartnerSetupVisibleBoolean;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SetupBusinessPartner();
                    end;
                }
                action(SIM_EDS_FB_ConfigureBP)
                {
                    ApplicationArea = All;
                    Caption = 'View/Configure Business Partner';
                    Image = EditCustomer;
                    Visible = GlobalIsBPConfigurationActiveBoolean;
                    ToolTip = 'If there is an Document Dispatch business partner setup, the Document Dispatch business partner setup page will be opened.';

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ConfigureBusinessPartner();
                    end;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        GlobalIsUserRegisteredBoolean := CurrPage.SIM_EDSFB.Page.IsUserRegistered();
    end;

    trigger OnAfterGetCurrRecord()
    var
        LocalRecordSIMEDSSetup: Record "SIM_EDS Setup";
        LocalCodeunitSIMCOREMgt: Codeunit "SIM_CORE Mgt";
    begin
        if not LocalCodeunitSIMCOREMgt.CheckPermissions(UserSecurityId(), 'SIM_EDS USER | SIM_EDS ADMIN | SUPER') then exit;
        if not LocalRecordSIMEDSSetup.Get() then exit;
        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);

        GlobalMultipleOutputTypesExistsBoolean := CurrPage.SIM_EDSFB.Page.HasMultipleOutputTypes();
        GlobalSelectedContainsDownloadBoolean := CurrPage.SIM_EDSFB.Page.HasDownload();
        GlobalIsEPostBoolean := CurrPage.SIM_EDSFB.Page.HasEPost();
        GlobalIsPrintListBoolean := CurrPage.SIM_EDSFB.Page.HasPrintList();
        GlobalCancelVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsCancelVisible();
        GlobalBusinessPartnerSetupVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsBusinessPartnerSetupVisible();
        GlobalIsBPConfigurationActiveBoolean := CurrPage.SIM_EDSFB.Page.IsBPConfigurationActive();
    end;

    var
        GlobalSelectedContainsDownloadBoolean: Boolean;
        GlobalIsUserRegisteredBoolean: Boolean;
        GlobalMultipleOutputTypesExistsBoolean: Boolean;
        GlobalIsEPostBoolean: Boolean;
        GlobalIsPrintListBoolean: Boolean;
        GlobalCancelVisibleBoolean: Boolean;
        GlobalBusinessPartnerSetupVisibleBoolean: Boolean;
        GlobalIsBPConfigurationActiveBoolean: Boolean;
}
Liste
- Für Document Dispatch ab BC24
pageextension 5487166 "SIM_EDS PostedSalesInvoicesExt" extends "Posted Sales Invoices" //143
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_EDSFB; "SIM_EDS FB")
            {
                ApplicationArea = All;
            }
        }
    }
    actions
    {
        addafter(Category_Category5)
        {
            group(SIM_EDS_Actions_Promoted)
            {
                Caption = 'Document Dispatch';
                ShowAs = Standard;
                Image = SendTo;
                Visible = GlobalIsUserRegisteredBoolean;

                actionref(SIM_EDS_FB_Send_Promoted; SIM_EDS_FB_Send) { }
                actionref(SIM_EDS_FB_SendDialog_Promoted; SIM_EDS_FB_SendDialog) { }
                actionref(SIM_EDS_FB_DownloadAction_Promoted; SIM_EDS_FB_DownloadAction) { }
                actionref(SIM_EDS_FB_Schedule_Promoted; SIM_EDS_FB_Schedule) { }
                actionref(SIM_EDS_FB_Cancel_Promoted; SIM_EDS_FB_Cancel) { }
                actionref(SIM_EDS_FB_Multimail_Promoted; SIM_EDS_FB_Multimail) { }
                actionref(SIM_EDS_FB_OneDrive_Promoted; SIM_EDS_FB_OneDrive) { }
                actionref(SIM_EDS_FB_SetupBP_Promoted; SIM_EDS_FB_SetupBP) { }
                actionref(SIM_EDS_FB_ConfigureBP_Promoted; SIM_EDS_FB_ConfigureBP) { }
            }
        }

        addlast(processing)
        {
            group(SIM_EDS_FB_Actions)
            {
                Caption = 'Document Dispatch';
                Visible = GlobalIsUserRegisteredBoolean;

                action(SIM_EDS_FB_Send)
                {
                    Caption = 'Send';
                    ToolTip = 'Send the pre-configured documents to the business partner for all selected entries.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalAtLeastOneOutputTypeExistsBoolean;

                    trigger OnAction()
                    var
                        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
                        LocalCodeunitSIMEDSQueueMgt: Codeunit "SIM_EDS Queue Mgt";
                        LocalRecordRef: RecordRef;
                    begin
                        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
                        if LocalRecordSalesInvoiceHeader.FindSet() then
                            repeat
                                LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
                                LocalCodeunitSIMEDSQueueMgt.SendEDS(LocalRecordRef, true, false, '');
                                LocalRecordRef.Close();
                            until LocalRecordSalesInvoiceHeader.Next() = 0;
                        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);
                    end;
                }
                action(SIM_EDS_FB_SendDialog)
                {
                    Caption = 'Send Dialog';
                    ToolTip = 'Edit or personalize the email before sending it to the business partner.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalAtLeastOneOutputTypeExistsBoolean and GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SendDialog();
                    end;
                }
                action(SIM_EDS_FB_DownloadAction)
                {
                    Caption = 'Download';
                    ToolTip = 'Download the pre-configured documents to the Document Dispatch business partner with the output type "Download" for all selected entries.';
                    Image = Download;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSelectedContainsDownloadBoolean;

                    trigger OnAction()
                    var
                        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
                        LocalCodeunitSIMEDSMgt: Codeunit "SIM_EDS Mgt";
                        LocalTargetRecordRef: RecordRef;
                    begin
                        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
                        LocalTargetRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
                        LocalCodeunitSIMEDSMgt.DownloadDPForPageExtension(LocalTargetRecordRef, 'Posted Sales Invoice');
                        LocalTargetRecordRef.Close();
                    end;
                }
                action(SIM_EDS_FB_Schedule)
                {
                    Caption = 'Schedule';
                    ToolTip = 'Open the settings for scheduled dispatch for all selected entries.';
                    Image = ChangeDate;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ScheduleWizard();
                    end;
                }
                action(SIM_EDS_FB_Cancel)
                {
                    Caption = 'Cancel';
                    ToolTip = 'Cancel the dispatch for all selected entries. If the dispatch is scheduled or delayed and not yet executed, cancel the dispatch.';
                    Image = Cancel;
                    ApplicationArea = All;
                    Visible = GlobalCancelVisibleBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Cancel();
                    end;
                }
                action(SIM_EDS_FB_Multimail)
                {
                    Caption = 'Multimail';
                    ToolTip = 'Send all marked entries via email.';
                    Ellipsis = true;
                    Image = SendTo;
                    ApplicationArea = All;
                    Visible = GlobalAtLeastOneOutputTypeExistsBoolean and not GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Multimail();
                    end;
                }
                action(SIM_EDS_FB_OneDrive)
                {
                    Caption = 'Share through OneDrive';
                    ToolTip = 'Share the selected record through a OneDrive link.';
                    Ellipsis = true;
                    Image = Share;
                    Visible = GlobalSelectedContainsDownloadBoolean;
                    ApplicationArea = All;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.OneDriveShare('Posted Sales Invoice');
                    end;
                }
                action(SIM_EDS_FB_SetupBP)
                {
                    ApplicationArea = All;
                    Caption = 'Set up Business Partner';
                    ToolTip = 'Open the wizard to set up this Document Dispatch business partner for electronic dispatch, if not yet activated.';
                    Image = SalesPerson;
                    Visible = GlobalBusinessPartnerSetupVisibleBoolean and GlobalSingleEntrySelectedBoolean;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SetupBusinessPartner();
                    end;
                }
                action(SIM_EDS_FB_ConfigureBP)
                {
                    ApplicationArea = All;
                    Caption = 'View/Configure Business Partner';
                    Image = EditCustomer;
                    Visible = GlobalIsBPConfigurationActiveBoolean and GlobalSingleEntrySelectedBoolean;
                    ToolTip = 'Open the Document Dispatch business partner setup page if a setup exists.';

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ConfigureBusinessPartner();
                    end;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        GlobalIsUserRegisteredBoolean := CurrPage.SIM_EDSFB.Page.IsUserRegistered();
    end;

    trigger OnAfterGetCurrRecord()
    var
        LocalRecordSIMEDSSetup: Record "SIM_EDS Setup";
        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
        LocalCodeunitSIMCOREMgt: Codeunit "SIM_CORE Mgt";
        LocalRecordRef: RecordRef;
    begin
        if not LocalCodeunitSIMCOREMgt.CheckPermissions(UserSecurityId(), 'SIM_EDS USER | SIM_EDS ADMIN | SUPER') then exit;
        if not LocalRecordSIMEDSSetup.Get() then exit;

        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
        LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
        CurrPage.SIM_EDSFB.Page.ProcessSelection(LocalRecordRef, Rec);

        GlobalSingleEntrySelectedBoolean := CurrPage.SIM_EDSFB.Page.IsSingleEntrySelected();
        GlobalAtLeastOneOutputTypeExistsBoolean := CurrPage.SIM_EDSFB.Page.GetAtLeastOneOutputTypeExists();
        GlobalSelectedContainsDownloadBoolean := CurrPage.SIM_EDSFB.Page.GetSelectedContainsDownloadBoolean();
        GlobalCancelVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsCancelVisible();
        GlobalBusinessPartnerSetupVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsBusinessPartnerSetupVisible();
        GlobalIsBPConfigurationActiveBoolean := CurrPage.SIM_EDSFB.Page.IsBPConfigurationActive();
    end;

    var
        GlobalIsUserRegisteredBoolean: Boolean;
        GlobalCancelVisibleBoolean: Boolean;
        GlobalBusinessPartnerSetupVisibleBoolean: Boolean;
        GlobalIsBPConfigurationActiveBoolean: Boolean;
        GlobalSingleEntrySelectedBoolean: Boolean;
        GlobalAtLeastOneOutputTypeExistsBoolean: Boolean;
        GlobalSelectedContainsDownloadBoolean: Boolean;
}
- Für Document Dispatch ab BC25 und aufwärts
pageextension 5487166 "SIM_EDS PostedSalesInvoicesExt" extends "Posted Sales Invoices" //143
{
    layout
    {
        addfirst(FactBoxes)
        {
            part(SIM_EDSFB; "SIM_EDS FB")
            {
                ApplicationArea = All;
            }
        }
    }
    actions
    {
        addafter(Category_Category5)
        {
            group(SIM_EDS_Actions_Promoted)
            {
                Caption = 'Document Dispatch';
                ShowAs = Standard;
                Image = SendTo;
                Visible = GlobalIsUserRegisteredBoolean;

                actionref(SIM_EDS_FB_Send_Promoted; SIM_EDS_FB_Send) { }
                actionref(SIM_EDS_FB_SendDialog_Promoted; SIM_EDS_FB_SendDialog) { }
                actionref(SIM_EDS_FB_DownloadAction_Promoted; SIM_EDS_FB_DownloadAction) { }
                actionref(SIM_EDS_FB_Schedule_Promoted; SIM_EDS_FB_Schedule) { }
                actionref(SIM_EDS_FB_Cancel_Promoted; SIM_EDS_FB_Cancel) { }
                actionref(SIM_EDS_FB_Multimail_Promoted; SIM_EDS_FB_Multimail) { }
                actionref(SIM_EDS_FB_OneDrive_Promoted; SIM_EDS_FB_OneDrive) { }
                actionref(SIM_EDS_FB_AddToPrintList_Promoted; SIM_EDS_FB_AddToPrintList) { }
                actionref(SIM_EDS_FB_SetupBP_Promoted; SIM_EDS_FB_SetupBP) { }
                actionref(SIM_EDS_FB_ConfigureBP_Promoted; SIM_EDS_FB_ConfigureBP) { }
            }
        }
        addlast(processing)
        {
            group(SIM_EDS_FB_Actions)
            {
                Caption = 'Document Dispatch';
                Visible = GlobalIsUserRegisteredBoolean;

                action(SIM_EDS_FB_Send)
                {
                    Caption = 'Send';
                    ToolTip = 'Send the pre-configured documents to the business partner for all selected entries.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalAtLeastOneOutputTypeExistsBoolean or GlobalSelectedContainsEPostBoolean;

                    trigger OnAction()
                    var
                        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
                        LocalCodeunitSIMEDSQueueMgt: Codeunit "SIM_EDS Queue Mgt";
                        LocalRecordRef: RecordRef;
                    begin
                        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
                        if LocalRecordSalesInvoiceHeader.FindSet() then
                            repeat
                                LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
                                LocalCodeunitSIMEDSQueueMgt.SendEDS(LocalRecordRef, true, false, '');
                                LocalRecordRef.Close();
                            until LocalRecordSalesInvoiceHeader.Next() = 0;
                        CurrPage.SIM_EDSFB.Page.SetVariant(Rec);
                    end;
                }
                action(SIM_EDS_FB_SendDialog)
                {
                    Caption = 'Send Dialog';
                    ToolTip = 'Edit or personalize the email before sending it to the business partner.';
                    Image = Email;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = (GlobalAtLeastOneOutputTypeExistsBoolean or GlobalSelectedContainsEPostBoolean) and GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SendDialog();
                    end;
                }
                action(SIM_EDS_FB_DownloadAction)
                {
                    Caption = 'Download';
                    ToolTip = 'Download the pre-configured documents to the Document Dispatch business partner with the output type "Download" for all selected entries.';
                    Image = Download;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSelectedContainsDownloadBoolean;

                    trigger OnAction()
                    var
                        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
                        LocalCodeunitSIMEDSMgt: Codeunit "SIM_EDS Mgt";
                        LocalTargetRecordRef: RecordRef;
                    begin
                        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
                        LocalTargetRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
                        LocalCodeunitSIMEDSMgt.DownloadDPForPageExtension(LocalTargetRecordRef, 'Posted Sales Invoice');
                        LocalTargetRecordRef.Close();
                    end;
                }
                action(SIM_EDS_FB_Schedule)
                {
                    Caption = 'Schedule';
                    ToolTip = 'Open the settings for scheduled dispatch for all selected entries.';
                    Image = ChangeDate;
                    ApplicationArea = All;
                    Ellipsis = true;
                    Visible = GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ScheduleWizard();
                    end;
                }
                action(SIM_EDS_FB_Cancel)
                {
                    Caption = 'Cancel';
                    ToolTip = 'Cancel the dispatch for all selected entries. If the dispatch is scheduled or delayed and not yet executed, cancel the dispatch.';
                    Image = Cancel;
                    ApplicationArea = All;
                    Visible = GlobalCancelVisibleBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Cancel();
                    end;
                }
                action(SIM_EDS_FB_Multimail)
                {
                    Caption = 'Multimail';
                    ToolTip = 'Send all marked entries via email.';
                    Ellipsis = true;
                    Image = SendTo;
                    ApplicationArea = All;
                    Visible = GlobalAtLeastOneOutputTypeExistsBoolean and not GlobalSingleEntrySelectedBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.Multimail();
                    end;
                }
                action(SIM_EDS_FB_OneDrive)
                {
                    Caption = 'Share through OneDrive';
                    ToolTip = 'Share the selected record through a OneDrive link.';
                    Ellipsis = true;
                    Image = Share;
                    Visible = GlobalSelectedContainsDownloadBoolean;
                    ApplicationArea = All;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.OneDriveShare('Posted Sales Invoice');
                    end;
                }
                action(SIM_EDS_FB_SetupBP)
                {
                    ApplicationArea = All;
                    Caption = 'Set up Business Partner';
                    ToolTip = 'Open the wizard to set up this Document Dispatch business partner for electronic dispatch, if not yet activated.';
                    Image = SalesPerson;
                    Visible = GlobalBusinessPartnerSetupVisibleBoolean and GlobalSingleEntrySelectedBoolean;
                    Ellipsis = true;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.SetupBusinessPartner();
                    end;
                }
                action(SIM_EDS_FB_ConfigureBP)
                {
                    ApplicationArea = All;
                    Caption = 'View/Configure Business Partner';
                    Image = EditCustomer;
                    Visible = GlobalIsBPConfigurationActiveBoolean and GlobalSingleEntrySelectedBoolean;
                    ToolTip = 'Open the Document Dispatch business partner setup page if a setup exists.';

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.ConfigureBusinessPartner();
                    end;
                }
                action(SIM_EDS_FB_AddToPrintList)
                {
                    Caption = 'Add to Print List';
                    ToolTip = 'Add the selected entries to the print list.';
                    Image = PrintCheck;
                    ApplicationArea = All;
                    Visible = GlobalSelectedContainsPrintListBoolean;

                    trigger OnAction()
                    begin
                        CurrPage.SIM_EDSFB.Page.AddToPrintList();
                    end;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        GlobalIsUserRegisteredBoolean := CurrPage.SIM_EDSFB.Page.IsUserRegistered();
    end;

    trigger OnAfterGetCurrRecord()
    var
        LocalRecordSIMEDSSetup: Record "SIM_EDS Setup";
        LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
        LocalCodeunitSIMCOREMgt: Codeunit "SIM_CORE Mgt";
        LocalRecordRef: RecordRef;
    begin
        if not LocalCodeunitSIMCOREMgt.CheckPermissions(UserSecurityId(), 'SIM_EDS USER | SIM_EDS ADMIN | SUPER') then exit;
        if not LocalRecordSIMEDSSetup.Get() then exit;

        CurrPage.SetSelectionFilter(LocalRecordSalesInvoiceHeader);
        LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
        CurrPage.SIM_EDSFB.Page.ProcessSelection(LocalRecordRef, Rec);

        GlobalSingleEntrySelectedBoolean := CurrPage.SIM_EDSFB.Page.IsSingleEntrySelected();
        GlobalAtLeastOneOutputTypeExistsBoolean := CurrPage.SIM_EDSFB.Page.GetAtLeastOneOutputTypeExists();
        GlobalSelectedContainsDownloadBoolean := CurrPage.SIM_EDSFB.Page.GetSelectedContainsDownloadBoolean();
        GlobalSelectedContainsEPostBoolean := CurrPage.SIM_EDSFB.Page.GetSelectedContainsEPostBoolean();
        GlobalSelectedContainsPrintListBoolean := CurrPage.SIM_EDSFB.Page.GetSelectedContainsPrintListBoolean();
        GlobalCancelVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsCancelVisible();
        GlobalBusinessPartnerSetupVisibleBoolean := CurrPage.SIM_EDSFB.Page.IsBusinessPartnerSetupVisible();
        GlobalIsBPConfigurationActiveBoolean := CurrPage.SIM_EDSFB.Page.IsBPConfigurationActive();
    end;

    var
        GlobalIsUserRegisteredBoolean: Boolean;
        GlobalCancelVisibleBoolean: Boolean;
        GlobalBusinessPartnerSetupVisibleBoolean: Boolean;
        GlobalIsBPConfigurationActiveBoolean: Boolean;
        GlobalSingleEntrySelectedBoolean: Boolean;
        GlobalAtLeastOneOutputTypeExistsBoolean: Boolean;
        GlobalSelectedContainsDownloadBoolean: Boolean;
        GlobalSelectedContainsEPostBoolean: Boolean;
        GlobalSelectedContainsPrintListBoolean: Boolean;
}

Info

Die Document Dispatch Factbox ermöglicht das Versenden von Dokumenten für die gewünschten Einträge. Sie stellt sicher, dass Dokumente auf Basis der konfigurierten Versandlogik an die richtigen Empfänger übermittelt werden.