web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Email Editor (13, Document) - Customise attachment behaviour

(2) ShareShare
ReportReport
Posted on by 891
 
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?
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    Hi, hope the following helps.
    Dynamics 365 Business Central: Automatically add default attachments in email sent (Email Editor) – Customization
     
    Thanks.
    ZHU
  • Nick Webb Profile Picture
    891 on at
    Many thanks, exactly what I was looking for.

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

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans