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?