Dynamics 365 Business Central: “Contact by Email” in fields with ExtendedDatatype “EMail”

Dynamics 365 Business Central

Hi, Readers.
Two weeks ago, we discussed a new feature of Business Central V18.3, “Contact by Email” and “Sent Emails” on a Contact, Customer, and Vendor. At the end of the post, I tried to add this feature to other pages.
For example: on the Users (9800, List) page

And I saw a question on Twitter yesterday, is there any way to embed the “Contact by Email” in fields with ExtendedDatatype “EMail”?
This is an interesting question.

First, let’s review what is ExtendedDatatype Property and where ExtendedDatatype Property is used.

ExtendedDatatype Property: Sets the extended data type of a control.

Applies to:

  • Table Field
  • Page Field

Property Value:

ValueDescription
NoneDefault value. No conversion is applied.
PhoneNoThe client handles the field as a phone number and will display this as hyperlinked whenever the field is not editable. Activating the hyperlink will launch the default dialing app on your device.
URLThe client handles the field as a URL and the text will be displayed as hyperlinked whenever the field is not editable. Activating the hyperlink will open the URL using the default browser on your device.
EMailThe client handles the field as an email address and will display this as hyperlinked whenever the field is not editable. Activating the hyperlink will launch the default mail app on your device.
RatioThe text is handled as a progress bar. This is not supported on the Web client.
MaskedDisplays the value as dots. This will only have effect on fields, where the user can enter and display textual data (including numbers, time, date etc.)
PersonThe client handles the field as media representing a person and will display this in the signature rounded styling. When the media field is empty, a silhouette of a person is shown.

More details: How to set the extended data type of a field (ExtendedDataType Property)

You can find an example of Email on page 9084 “Customer Details FactBox”.

As stated in the MS Docs, activating the hyperlink will launch the default mail app on your device.

Default mail app on your device:

For example:

This is also very convenient, but please note that it is not possible to save this record on the Sent Email page of Business Central by this way.

So can we change this default behavior? When the user activates the email hyperlink, the Contact by Email feature will be used inside Business Central.

Yes, this time we can use OnDrillDwon trigger.

Test Video:

Source Code:

pageextension 50101 CustomerDetailsFactBoxExt extends "Customer Details FactBox"
{
    layout
    {
        modify("E-Mail")
        {
            trigger OnDrillDown()
            var
                Email: Codeunit Email;
                EmailMessage: Codeunit "Email Message";
            begin
                EmailMessage.Create(Rec."E-Mail", '', '', true);
                Email.AddRelation(EmailMessage, Database::Customer, Rec.SystemId, Enum::"Email Relation Type"::"Primary Source");
                Email.OpenInEditorModally(EmailMessage);
            end;
        }
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL