
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 06:08 AM
Hi,
I set up an email notification to the assignee if the record got updated by the user. My email notification doesn't work if the user added attachment to an existing ticket via our portal without adding comments. The only time it works if the user added comment. I want the assignee to get notification if the user added attachment to the request.
Thanks,
S
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 04:08 PM
Here is the updated script:
var getINC = new GlideRecord('incident');
getINC.addQuery('sys_id',current.table_sys_id);
getINC.query();
if(getINC.next()){
getINC.comments = 'Attachment has been added!';
getINC.update();
}
Change the table name with custom table name you have.
Regards,Sushant Malsure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 06:19 AM
Attachments get added to the sys_attachment table. You could create a notification on that table as well checking if an attachment associated with table X gets added.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 09:21 AM - edited 07-29-2023 09:22 AM
Thanks Elijah, I created another notification on "sys_attachment" table and selected the condition "table name" under when to send but I am not sure about "who will receive" tab. Do I leave it empty or what should I select?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 01:03 PM
HI @sparkles
You have 2 options here to keep assinged_to informed when attachement is added.
Assuming table in incident if not read following comment as your 'table_name'
Option 1: Create a notification on attachment table itself with condition as table= incident and a script to calculate whom to send. I think you already tried that and there is little complexity associated in that.
Option 2 : This is my suggestion .
Create After Insert Business rule on sys_attachment table
Condition as table = incident
Script:
var getINC = new GlideRecord('incident');
getINC.get(current.table_sys_id);
getINC.comments = 'Attachment has been added!';
getINC.update();
Above BR will add comment in related incident everytime when attachment is added which will eventually trigger an notification to assigned_to person.
By this way you can keep assigned user informed about new attachment addition on incident.
Regards,Sushant Malsure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 03:46 PM - edited 07-29-2023 03:48 PM
Hi Sushant,
I went with the second option (BR) it works but I am getting the error below from the portal side when I add the attachment.
"Unique Key violation detected by database ((conn=1524186) Duplicate entry '4499bc8987f5ed90964cda473cbb35d0' for key 'PRIMARY')"
Do I need to adjust anything in the script? my table is not the incident table, its a custom table.
Thanks,