The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Send static attachment file in notification

Mayank Rustagi
Tera Guru

Is there a way to add a static attachment file to a notification?

We need it to be a file attachment and not a link to the attachment or a KB article in the email body.

 

Thanks!

3 REPLIES 3

Steven Parker
Giga Sage

This link should be able to help:

https://www.servicenow.com/community/developer-forum/how-to-send-attachment-in-an-email-notification... 

 

Steps:

1. Attach required document to the notification

2. Click on "What it will contain" tab

3. Go to "Message HTML" field

4. Click on "Insert or Edit link" option available in the field

5. Select Type as "Attachment" from the dropdown

6. Select URL as "required document[uploaded attachment]" from the dropdown

7. Type some text in the "Text"

8. Target as your choice

9. Click on "OK" button

10. Trigger the notification, receiver can receive email along with attachment!!

 

I haven't tested this myself...the way I got it to work was way more work than this sounds like.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

@Steven Parker 

The above solution does not work. Could you please share the way you've achieved this?

Now let me start by saying....I having used this in a while and haven't tested this in a while, but it worked when I was working on this a few years ago.  I am going to give you the short version as I don't have much time - test this in your own Personal Dev Instance:

 

- Essentially you create an event in the event registry and a brand new notification like you would for any new notification (notification is obviously fired from the event)

- Then, you create a knowledge article that has nothing in it, but the attachment you want to use and any other mandatory fields you need to fill in like Short Description

- Then in your workflow, you have a run script that looks like this for sending the notification:

 

   var gr = new GlideRecord("kb_knowledge");
       gr.addEncodedQuery("workflow_state=draft^short_description=your_knowledge_article_short_description");
       gr.query();
       if (gr.next()) {
             gs.eventQueue("u_founders_corporatecreditcard", gr, current.variables.requested_for);
       }

 

 You can change the query if you want to find the Knowledge Article you want to use...I just filtered the KB list and used an 'addEncodedQuery' by copying the query from the list filter.

 

Basically this sends the notification you created using the event you created, but uses the knowledge article attachment to add to the notification.  


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven