Email notification

sparkles
Tera Contributor

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,

1 ACCEPTED SOLUTION

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.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

View solution in original post

9 REPLIES 9

Elijah Aromola
Mega Sage

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. 

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

sushantmalsure
Mega Sage
Mega Sage

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.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

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,