Sending the Selected Attachments in an Email Notification.
Hi Buddies,
I have seen most of the guys searching for this topic and recently one of my friend also asked me to help him in 'sending the selected attachments in the email notification from our incident record '.
Generally,There are two approaches to do this.....
1.We can copy the selected attachments to the sys_email table from our incidents(lets say).
2.We can tick the include attachments check box in our notification and then delete the unnecessary attachments while copying the attachments from the incident table to the sys_email table.
Now I am going through the approach no.2 as this is somewhat a simple one.
For this approach create a new field of type 'boolean' on the sys_attachment table.
These are the steps that we need to follow in this approach.
1.First add the attachments section in our incident form Related Lists(This is to select the Required Attachments for our notification).
2.Then add a UI action to select the required attachments(we are going to populate the newly created field on the sys_attachment table to either true or false based on the UI action that we wrote.)
3.Then Write a Script Include to get the sys_id's of selected attachments to the server side.
4.Now finally write a Before Insert Business Rule to copy the selected attachments to the sys_email table.
Guys,If u feel this article needs some more information then please go through these codes once.
Here I am attaching the XML's of UI action ,Business Rule and Script Include.Feel Free to ask Doubts on this Article..I am always happy to help you Guys.
https://www.servicenow.com/community/developer-articles/sending-the-selected-attachments-in-an-email-notification/ta-p/2319859