Ga naar inhoud

Pagina's uitbreiden met de Document Dispatch Factbox

Deze documentatie beschrijft hoe je een pagina in Business Central kunt uitbreiden met de Document Dispatch Factbox. De factbox wordt gebruikt om een overzicht te krijgen van de geconfigureerde subitems, zoals de beschikbaarheid van verzendopties, en om documenten direct te versturen wanneer ze correct zijn ingesteld.

Een volledige pagina-extensie voor Document Dispatch bestaat uit twee delen:

  1. Layout – De factbox (SIM_EDS FB) wordt toegevoegd aan het FactBoxes-gebied van de pagina.
  2. Actions – De Document Dispatch-acties (bijv. Verzenden, Downloaden, Plannen) worden als actiegroep geïntegreerd in het lint van de pagina.

Vanaf versie 25 zijn aanvullende acties geïntroduceerd die niet bestaan in BC24. De codevoorbeelden zijn daarom onderverdeeld per versie.

Er zijn twee manieren om de extensie op te nemen:

  1. Als u een aangepaste pagina gebruikt, kan de code direct aan de pagina worden toegevoegd.
  2. Als je bestaande pagina's wilt uitbreiden, kun je een pagina-extensie maken die de code uitvoert.

Vereisten

Aan de volgende vereisten moet worden voldaan:

  • De Document Dispatch module moet gelicenseerd zijn.
  • CORE moet als referentie beschikbaar zijn in de extensie.
  • Document Dispatch moet als referentie beschikbaar zijn in de extensie.

Uitbreiding van een Business Central pagina met de Document Dispatch Factbox

Kaart
- Voor Document Dispatch vanaf 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;
}
- Voor Document Dispatch vanaf BC25 en hoger
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;
}
Lijst
- Voor Document Dispatch vanaf 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;
}
- Voor Document Dispatch vanaf BC25 en hoger
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

Met de Document Dispatch Factbox kunnen documenten worden verzonden voor de gewenste items. Het zorgt ervoor dat documenten naar de juiste ontvangers worden verzonden op basis van de geconfigureerde verzendlogica.