Attach File to Workflow Notification

ServiceNow_Use2
Kilo Expert

Hi,

I have a workflow tied to a service catalog item.  The workflow is essentially: 
Begin
If a certain checkbox from the service catalog item is checked upon ordering,
Yes (it is checked) - Send Notification Email (format #1)
No (it is not checked) - Send Notification Email (format #2)
End

This process works great.  However, If the checkbox IS selected, I need to attach a file to the email that gives users extra information about their order.  I have many versions of this document (PDF, .doc, .docx, .txt, etc.), so any file type will do (if one is easier to attach than others).  Is it possible to send my custom file as an attachment to the workflow notification?  

One thing - this file is not being uploaded to the system at the time of order.  This is a file that I manage that I would like to include in the workflow somehow so that all users who check the checkbox will get the file in their notification after placing their order.  

Any guidance would be greatly appreciated.

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

yes, it's possible, follow the procedure below:

1) Create a notification email script under system notification click on New and use the following code:

template.print('Attachment: <a href="sys_attachment.do?sys_id=sys_id of the attachment">Name of the attachment</a>');

2) Under Workflow notification activity under Message box you can call this email notification script name: 

${mail_script:nameof attachment}

Enjoy 🙂

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

View solution in original post

4 REPLIES 4

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

yes, it's possible, follow the procedure below:

1) Create a notification email script under system notification click on New and use the following code:

template.print('Attachment: <a href="sys_attachment.do?sys_id=sys_id of the attachment">Name of the attachment</a>');

2) Under Workflow notification activity under Message box you can call this email notification script name: 

${mail_script:nameof attachment}

Enjoy 🙂

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Alberto,

Where would I need to upload my file in the system to get it's sysID? 

adaml
Mega Expert

This doesn't work if you are trying to send an attachment to a non-itil user. Say, for example you want to share a file with an employee as part of a workflow. The non-itil user doesn't have access to the record.

Afsar2
Tera Contributor

Thanks @adaml ,

You are right. This approach of accessing sys_attachment via links in email is not good option for end users who have limited access to platform.

Adding ACL rules for end users to access sys_attachment records might not be a good practice and raise security concerns.

Alternate approach I believe is to add this attachment to Knowledge Article record and trigger it by email notifications set on kb_knowledge table. Email Notification must have Include attachment set.

 

Thank you,

Afsar Sheikh