Hi All,
We followed good advice from zhums and others which gave us the ability to add attachment factbox to records such as Warehouse Shipment and Opportunity. This included instructions on adding event subscribers to the relavent Document Attachment integration events. This works for users added and accessing attachments from those pages.
However, when emailing and trying to use the Add Related Attachments from Source functionality on when previewing/editing a draft email it shows all document attachments related to those tables rather than the specific record in that table.
We have found another event subscriber but interestingly when we go back to the original codeunit cannot find anything that gives an example implementation. We suspect this is because the individual app extensions for Office 365 Email, SMTP Email might be implementing this, but their code isn't available in AL Explorer.
[EventSubscriber(ObjectType::Codeunit, Codeunit::Email, OnFindRelatedAttachments, '', false, false)] local procedure Email_OnFindRelatedAttachments(SourceTableId: Integer; SourceSystemID: Guid; var EmailRelatedAttachments: Record /Email Related Attachment/ temporary) var
Hoping someone can help us figure out the correct code to ensure that for non-standard tables Document Attachments get filtered to the correct source records. We know something is happening as it shows all related attachments, it just isn't being filtered.