
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2015 12:42 PM
Hello all,
I am working on a vendor project and having an issue with attachments in notifications. I have two PDF attachments that I am trying to include in a notification that goes out to an external customer (outside of our ServiceNow). I have written the email script and added it to the notification body to include the attachment and it works. The problem that I am having is that in order to open the document, the user must be signed in to ServiceNow, otherwise, they are not able to open the document. Has anyone been able to send notifications from servicenow with attachments to an external user that does not require to log in to the instance? I have attached some screenshots for you to see. Please let me know of any ideas.
Email script:
part of the notification (i have checked the "Include attachments" box but that didn't make a difference.
email the user should receive:
when clicking on the links, this is what the user gets:
Please let me know of what I can do to fix this issue.
Thank you!
Yeny Garcia
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 10:37 AM
Hello all,
I was able to get this working using a business rule to attach the documents to the email. I hope that this helps other users also who are stuck on the same issue.
First, attach the documents to the notification that will be triggered. Then create a business rule on the sys_email table.
BR
When: Before, Insert
Condition: current.mailbox.getDisplayName() != "Sent" && current.subject == "NEW APPROVED VENDOR EMAIL"
Script:
var strTemp = '';
var attachment = new GlideRecord('sysevent_email_action');
attachment.addQuery('name', 'CONTAINS', 'email to vendor');
attachment.query();
while (attachment.next()) {
strTemp = attachment.sys_id.toString();
//copy the found attachment to the new data source above.
GlideSysAttachment.copy('sysevent_email_action', strTemp, 'sys_email', current.sys_id);
gs.log('Copy of attcahments for ' + strTemp);
}
This got me to attach the actual document to the email vs the link. Hope this helps. If you have a better way of doing this though, please let me know!
Thank you,
Yeny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 06:44 AM
Instead of using the package call you need to use GlideSysAttachment.copy() as package calls are no longer allowed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 06:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 11:15 AM
I did like the look of this Harish but unfortunately it doesn't work as the current sys_id in this line:
GlideSysAttachment.copy (gr.table_name, gr.sys_id, 'sys_email', current.sys_id);
Doesn't work because it's of the source record and not the sys_email record. It seems doing it in the Notification (which I would prefer) you can't get the sys_email sys_id and doing it in the Business Rule you can't get the sysevent_email_action sys_id without doing a GlideRecord.
But at least it is possible.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 12:07 AM
how about using this field on the notification 'Include attachments'
http://wiki.servicenow.com/index.php?title=Email_Notifications#Advanced_View_Fields

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 06:28 AM
Hi Kalairasan,
I believe the field 'include attachments' will pull the attachments from the source record (like an incident) but I need them to be pulled from the notification record in the notification table... not sure how to do it... any ideas?
Thank you,
Yeny Garcia