Dynamics 365 Business Central: How to add multiple email addresses to a customer/vendor/contact

Dynamics 365 Business Central

Hi, Readers.
Today I would like to share another mini tip about Business Central, how to add multiple email addresses to a customer/vendor/contact.

Recently I’ve accidentally realized that some people don’t know how to add multiple email addresses. So in this post, I’m sharing it briefly.

It’s actually very simple. As you know, there is an E-mail field in the customer, vendor and contact.

Customer Card:

Vendor Card:

Contact Card:

In the standard demo environment, only one email address is set. Many people mistakenly think that only one email address can be entered here (The “address” in the field’s tooltip is also not pluralized). In fact, multiple email addresses can be entered in this field, just separate them with a semicolon, like in Outlook.
For example,
helen.ray@contoso.com; admin@CRMbc572567.onmicrosoft.com;yzhums@outlook.jp

When creating transactions associated with the master data, it will be added automatically, such as in Sales Order.

And when using the BC standard sending mail function, it will also be automatically added to To.

For orders created before adding multiple email addresses, you can also simply add them using the following way.

Very simple, give it a try!!!😁

PS:
1. This can be clued in from the standard code.

2. When customizing the email function, be careful not to use the List Data Type.

This causes a runtime error because of the semicolon in the text.

You can simply use the following method.

For example,

Source code:

pageextension 50112 MyExtension2 extends "Sales Order List"
{
    actions
    {
        addafter("Print Confirmation")
        {
            action(SendTestEmail)
            {
                Caption = 'Send Test Email';
                Promoted = true;
                PromotedCategory = Process;
                PromotedIsBig = true;
                Image = SendEmailPDF;
                ApplicationArea = All;

                trigger OnAction()
                var
                    EmailMessage: Codeunit "Email Message";
                    Email: Codeunit Email;
                    //Recipients: List of [Text];
                    Subject: Text;
                    Body: Text;
                    SalesOrderTitle: Label 'The Sales Document %2 of Customer %1 has been created.';
                    SalesOrderMsg: Label 'Dear Manager<br><br>The Sales Document <font color="red"><strong>%2</strong></font> of Customer <strong>%1</strong> has been created.<br> The total amount is <strong>%3</strong>. <br> User ID <strong>%4</strong>';
                begin
                    //Recipients.Add(Rec."Sell-to E-Mail");
                    Rec.CalcFields("Amount Including VAT");
                    Subject := StrSubstNo(SalesOrderTitle, Rec."Sell-to Customer Name", Rec."No.");
                    Body := StrSubstNo(SalesOrderMsg, Rec."Sell-to Customer Name", Rec."No.", Rec."Amount Including VAT", UserId);
                    EmailMessage.Create(Rec."Sell-to E-Mail", Subject, Body, true);
                    Email.Send(EmailMessage, Enum::"Email Scenario"::Default);
                end;
            }
        }
    }
}

3. Note that the length of E-mail field is 80.

End

Hope this will help.

Thanks for your reading.

ZHU

コメント

Copied title and URL