Can I send all the attachments of the RITM with email from the flow designer?

Stergios Stergi
Mega Guru

Hello!

I have managed to copy the attachment to the send email action but in the case when there is more than one attachment on the RITM the flow only copies the first attachment.
Is there a way to copy all the attachments?

I tried to use the For each item in the attachment list action to look up the attachment list and copy the attachments but I only receive the first attachment duplicated X times.

StergiosStergi_0-1700460795326.png

 

2 ACCEPTED SOLUTIONS

Hi @Stergios Stergi 

Okay I see.

In the Look Up Attachment step, You're using the output Attachment Sys ID which only store the sys_id of the first attachment.

TaiVu_0-1700476159402.png

The output should be used is the Attachment List one, it's an array contains elements as object type. So it might be difficult to work this out.

 

Let's try the simple approach below with just one query, use the Look Up Records instead.

TaiVu_1-1700476404113.png

TaiVu_2-1700476417799.png

 

Cheers,

Tai Vu

 

 

View solution in original post

Hey @Stergios Stergi 

You're using the Look Up Record action. Let's replace by the Look Up Records one. 😋

 

Cheers,

Tai Vu

View solution in original post

8 REPLIES 8

Tai Vu
Kilo Patron
Kilo Patron

Hey @Stergios Stergi 

We don't need to loop through each attachment to do the copy, just put the param for the Source ID as the RITM record, the the Target ID is the Email record.

Ref the API below.

GlideSysAttachment()

 

var attachment = new GlideSysAttachment();
var ritmID = '70bccc72472e7990ab9bb6bf016d434e'; //RITM0010017
var copiedAttachments = attachment.copy('sc_req_item', ritmID, 'sys_email', 'f4cc40b2472e7990ab9bb6bf016d4395');

Screenshot 2023-11-20 at 14.11.00.png

 

Screenshot 2023-11-20 at 14.11.16.png

 

Cheers,

Tai Vu

Stergios Stergi
Mega Guru

Hello @Tai Vu  nd thanx for the reply!
If understand correctly, the solution you proposed includes some coding.
Since my coding game is a bit weak, is there a no code solution?

Hi @Stergios Stergi 

If the notification is being triggered for the record from which the attachments originate, you can attempt this method by activating the "Include attachments" checkbox in the "What it will contain" section of the notification.

TaiVu_0-1700473172229.png

Include attachmentsSelect this check box to send all attachments from the triggering record as email attachments.

 

Or let double-check your Look Up step, it seems not giving the correct result for the Copy Attachment step.

I can see you perform 2 Look Up at the step 12 and 13, is it something expected?

 

Cheers,

Tai Vu

Stergios Stergi
Mega Guru

The section of the flow starts with the Look up Attachment where i pick up the attachment's SysID:

StergiosStergi_0-1700474948420.png

Then I use the Look up Attachment Record to filter the sys_attachment table with the sysID I picked up.

StergiosStergi_1-1700475105026.png

Lastly, I copy the attachment to the send email action from the source record of the previous action

StergiosStergi_2-1700475171904.png

 

The above flow works as I mentioned. But I only receive the first attachment posted on the form.

Is there a different way?