"Include attachments" not working as expected in an approval notification

KB15
Giga Guru

I've looked around and wasn't able to find a solution and maybe I'm not putting all the pieces together.

I need to get file attachments to be sent along within an approval email. I can get the attachment from an RITM to the sysapproval_approver record via a business rule. I can see that file is now visible in an approval record. I can't seem to get the files over to the email notification.

The notification is fired from an event and is triggered from the sysapproval_approver table via an event and I've set the "include attachments" option in the notification.

I was thinking the attachment would have to be in the request but that wasn't the case. What am I missing?

find_real_file.png

find_real_file.png

 

1 ACCEPTED SOLUTION

This was a simple fix though not necessarily logical.

You must copy the attachments from the source record to the target record. The notification will then be sent with the attachments when the event is triggered.

A business rule set to before and on insert should be sufficient. If this is specifically for an approval, the table in the BR is sysapproval_approver.

Add any conditions you need to the trigger.

In your script, simply add:

GlideSysAttachment.copy('your_source_table', current.sysapproval, 'sysapproval_approver', current.sys_id);

You can verify that this is working if you look at your attachments table. When the script runs, you'll see a copy of the attachment(s) from your source table to your target table.

View solution in original post

2 REPLIES 2

Chase Stevenson
Mega Guru

Did you ever get this working? It's unfortunate that nobody has replied regarding this issue. It's happening to me as well. The approval record has an attachment, but that 'include attachments' checkbox doesn't work for a notification being triggered off the approval table.

This was a simple fix though not necessarily logical.

You must copy the attachments from the source record to the target record. The notification will then be sent with the attachments when the event is triggered.

A business rule set to before and on insert should be sufficient. If this is specifically for an approval, the table in the BR is sysapproval_approver.

Add any conditions you need to the trigger.

In your script, simply add:

GlideSysAttachment.copy('your_source_table', current.sysapproval, 'sysapproval_approver', current.sys_id);

You can verify that this is working if you look at your attachments table. When the script runs, you'll see a copy of the attachment(s) from your source table to your target table.