Aller au contenu

Extension des pages avec Document Dispatch Factbox

Cette documentation décrit comment étendre une page dans Business Central avec la Document Dispatch Factbox. La factbox est utilisée pour obtenir une vue d'ensemble des sous-rubriques configurées, telles que la disponibilité des options d'envoi, et pour envoyer des documents directement lorsqu'ils sont correctement configurés.

Une extension de page complète pour Document Dispatch se compose de deux parties :

  1. Layout – La factbox (SIM_EDS FB) est ajoutée à la zone FactBoxes de la page.
  2. Actions – Les actions Document Dispatch (p. ex. Envoyer, Télécharger, Planifier) sont intégrées en tant que groupe d'actions dans le ruban de la page.

À partir de la version 25, des actions supplémentaires ont été introduites qui n'existent pas dans BC24. Les exemples de code sont donc divisés par version.

Il y a deux façons d'inclure l'extension :

  1. Si vous utilisez une page personnalisée, le code peut être ajouté directement à la page.
  2. Si vous souhaitez étendre des pages existantes, vous pouvez créer une extension de page qui exécute le code.

Exigences

Les conditions suivantes doivent être remplies :

  • Le module Document Dispatch doit être sous licence.
  • CORE doit être disponible dans l'extension en tant que référence.
  • Le module Document Dispatch doit être disponible dans l'extension en tant que référence.

Extension d'une page Business Central avec la Factbox Document Dispatch

Carte
- Pour Document Dispatch à partir de 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;
}
- Pour Document Dispatch à partir de BC25 et supérieur
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
- Pour Document Dispatch à partir de 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;
}
- Pour Document Dispatch à partir de BC25 et supérieur
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

Le Document Dispatch Factbox permet d'envoyer des documents pour les entrées souhaitées. Elle garantit que les documents sont envoyés aux bons destinataires en fonction de la logique d'envoi configurée.