Dynamics 365 Business Central: Add Word Templates to any pages

Dynamics 365 Business Central

Hi, Readers.
Last week we discussed how to use Word Templates in Business Central.
At the end of that post, I mentioned that Word Templates feature is also available on the Customer List, Customer Card, Vendor List, Vendor Card, Contact list, and Contact Card page by default.

So, we can use it directly.
For example:

But, is it possible to add this feature to other pages when needed?
Yes, it’s easier than one might think.

In this post, I will share an easy example, hope it will help.

Add Word Templates to Salespersons/Purchasers (14, List):

Source Code:

pageextension 50101 "Word Template on Salespersons" extends "Salespersons/Purchasers"
{
    actions
    {
        addfirst(processing)
        {
            action(WordTemplate)
            {
                Caption = 'Word Template';
                ToolTip = 'Apply a Word template on the selected records.';
                Image = Word;
                ApplicationArea = All;
                Promoted = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    Salesperson: Record "Salesperson/Purchaser";
                    WordTemplateSelectionWizard: Page "Word Template Selection Wizard";
                begin
                    CurrPage.SetSelectionFilter(Salesperson);
                    WordTemplateSelectionWizard.SetData(Salesperson);
                    WordTemplateSelectionWizard.RunModal();
                end;
            }
        }
    }
}

Published.

Create a new word template for Salesperson/purchaser.

Test video:

END

Hope this will help.

Thanks for reading.

ZHU

コメント

タイトルとURLをコピーしました