Select and Email Multiple attachments from a list of Documents - CloudFronts

Select and Email Multiple attachments from a list of Documents

Problem Statement:
I have a requirement where the user will select multiple attachments of choice from a list of Documents and Email them.


Pre-requisites:

  • VS Code
  • AL Language Extension
  • Microsoft Dynamics Business Central


Solution:

Step 1:

Create a drill-down on the field where the user will select attachments from a list of Documents. Here we have used Page Document Attachment Details as a drill-down page where I have attached some documents.

Drill Down


In the above code, I have created a drill-down of page Document Attachment Details.

SetSelectionFilter() – To get selected attachments from the list of Documents.

Step 2:

Here I have created Instream and Outstream Objects for Attachments as shown below:

In the below code Rec_Sample is a Record variable for sample table which contains the Media field “Document Reference” which stores the unique Document Reference ID of a single Document.
After that, the same document is exported and Imported using Exportstream and Importstream.

And AddAttachmentStream is called with the Instream object to add the attachment. This is done for the number of attachments selected and then the mail is sent.


Conclusion:


This way we can send Multiple attachments selected by the user and email them.

Hope this helps!


Share Story :

Secured By miniOrange