Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Email Editor (13, Document) - Customise attachment behaviour

(1) ShareShare
ReportReport
Posted on by 683
 
Hi,
 
I'm trying to customise the attachment behaviour in page: Email Editor (13) and it's listpart page: Email Attachments (8889). Here's an example scenario:
 
Let's say I have a Posted Sales Invoice with an attachment PDF with a filename that matches a convention of SupportLog_*.PDF (e.g.) SupportLog_TestCompany1.PDF or SupportLog_TestCompany2.PDF etc... as below;
 
 
... and I select the email action, the Email Editor (13) page is displayed with the invoice auto-inserted in PDF format into the Attachments ListPart at the bottom (as below):
 
 
... The aforementioned attachment has been auto-inserted into the Email Related Attachment (8910) temporary table and can be manually added via the 'Add file from source document' action as below:
 
 
My quest is to make the page load with the extra attachment auto-inserted without having to click the 'Add file from source document' action, as below:
 
 
I've investigated subscribing to various events:
 
[EventSubscriber(ObjectType::Table, Database::"Email Item", OnBeforeSetAttachments, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::Email, OnGetAttachment, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::Email, OnFindRelatedAttachments, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::Email, OnBeforeGetEmailAttachmentsByEmailScenarios, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Document Attachment Mgmt", OnSetRelatedAttachmentsFilterOnBeforeSetTableIdFilter, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Document Attachment Mgmt", OnAfterSetDocumentAttachmentFiltersForRecRefInternal, '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Document Attachment Mgmt", OnAfterSetDocumentAttachmentFiltersForRecRef, '', false, false)]
[EventSubscriber(ObjectType::Table, Database::"Document Attachment", OnBeforeGetAsTempBlob, '', false, false)]
[EventSubscriber(ObjectType::Table, Database::"Document Attachment", OnBeforeGetContentType, '', false, false)]
 
... but can't see one that offers the hook I'm looking for. I'm trying to find one that offers a reference to temporary tables: Email Related Attachment (8910) and 
Email Message Attachment (8904). Also, when trying to access the Email Message Attachment table in AL code, I get the error below:
 
I'm guessing that's something to do with Access = Internal?
 
table 8904 "Email Message Attachment"
{
    Access = Internal;
    InherentPermissions = X;
    InherentEntitlements = X;
 
 
Any ideas which event I should hook into?
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,036 Super User 2024 Season 2 on at
    Email Editor (13, Document) - Customise attachment behaviour
    Hi, hope the following helps.
    Dynamics 365 Business Central: Automatically add default attachments in email sent (Email Editor) – Customization
     
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,382 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans