Need to find out how to send a notification if an attachment is added to a incident

Community Alums
Not applicable

I am wanting to figure out how to notify if an attachment is added to an incident. I have other tables that this might apply to, so I need to understand one for now.


I understand from some research that I need the following

  1. An event in the event registry
    1. I have a system event in there called attachment.uploaded.  This is not associated with any table.
    2. Should I make a new event to tie it to the sys_attachment table?
  2. Then I need a business rule.
    1. Does the business rule need to be on the sys_attachment table or the Incident table?
  3. Notification
    1. I'm all set with the notification

I have looked at youtube on how to use an event to send a notification, and that makes sense, but the part I need clarification on is the attachment piece.  This seems like it would go into the script but not sure how to trigger that or write the script to look at the attachment. 
I don't know how to tell it when an attachment is uploaded to the incident record and then emailed to the assigned user. If someone could help me understand this or point me to a tutorial on how to do this, that would be awesome.

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

This one is quite easy peasy.

 

Create an on before business rule on sys_attachment table as follows.

Screenshot 2023-03-29 at 11.13.04 PM.pngScreenshot 2023-03-29 at 11.13.09 PM.png

In the second screenshot incident.attachment.uploaded should be replaced with your event name, current.table_sys_id is the sys_id of the incident on which the attachment was uploaded and email should be the email of the user to whom you would like to send this notification.

 

Hope this helps.

View solution in original post

2 REPLIES 2

BharathChintala
Mega Sage

@Community Alums  

Create one new event in event registry on incident table

Write Business rule on sys_attachment table

conditions table is incident

on insert

in advanced 

var inc= new GlideRecord('incident');

inc.get(current.table_sys_id);

gs.eventQueue('incident.commented', inc,inc.sys_id, '');

 

 

then in notification write on incident table and select when event is triggered 

 

 

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

Sandeep Rajput
Tera Patron
Tera Patron

This one is quite easy peasy.

 

Create an on before business rule on sys_attachment table as follows.

Screenshot 2023-03-29 at 11.13.04 PM.pngScreenshot 2023-03-29 at 11.13.09 PM.png

In the second screenshot incident.attachment.uploaded should be replaced with your event name, current.table_sys_id is the sys_id of the incident on which the attachment was uploaded and email should be the email of the user to whom you would like to send this notification.

 

Hope this helps.