Attachment.uploaded event for mail notification

laszlobolya
Kilo Expert

Hello, I thought it is easy but cannot figure it out to send a mail when notification attached to a ticket record.

Setup an email notification

When to Send:

event is fired, attachment.uploaded

Condition: Assigned_to is not empty

Weight 0

Who Will receive: assigned_to

Send to event creator is checked.

I can see that on Event log the attachment.uploaded event is triggered.

But no notification sent at all.

Tried a lot of thing, removed condition, checked parm1 parm2, but nothing happened, no mail sent.

Can you give me any advice? The table I use this notification in Application scope. Does it matter? Any idea welcome!

Thanks!

3 REPLIES 3

No NaME
Mega Guru

Could be small thing, is the assignee field filled and the assignee's email address is available in the user record.



Thanks!


MC_Soria
Kilo Expert

I'm working on this also. It seems that the attachment.upload is registered to the sys_attachment table, so using that event on a notification not on sys_attachment won't work (I've not gotten it to work that way anyway). That being the case, the challenge is how to use that event to trigger notifications from other tables.


I solved that part by writing a script action which is triggered by the attachment.upload event and then triggers other events via the gs.eventQueue() API. These secondary events are registered to other tables which correspond to the tables used by the notifications. Here is what my script action looks like:



// Condition: current.table_name >= "x_tnmu2_ecos"



// This script will trigger appropriate


// notifications from the ECOS tables



var croTable = event.parm1;



switch(croTable.trim()){


 


  case 'x_tnmu2_ecos_delivery':


  gs.eventQueue("x_tnmu2_ecos.attach_add_delivery", current, event.parm1, event.parm2);


  break;


 


  case 'x_tnmu2_ecos_facts_conditions':


  gs.eventQueue("x_tnmu2_ecos.attach_add_facon", current, event.parm1, event.parm2);


  break;


 


  case 'x_tnmu2_ecos_markets':


  gs.eventQueue("x_tnmu2_ecos.attach_add_markdim", current, event.parm1, event.parm2);


  break;



  default:


  gs.info("+++Error: No Case Matched for Script Action!");


 


}



The problem with this is I still don't have access to the original object that triggered the attachment.upload event. I'm thinking I'll need a email notification script to pull in the data I need since the sys_id of the record is passed in as a string parameter (event.parm2). Although this is a work in progress…



Does anyone have any better ideas? This is more work than I'd hoped it would be, but I'm sharing it here and hope it helps.



Thanks.



rajeevlochan82
Mega Guru

re you using gs.eventqueue to trigger event ? can you verify that you have registered your event with same table which you are passing as object in second parameter of   'gs.eventQueue' function gs.eventQueue('incident.commented', current, gs.getUserID(), gs.getUserName()) ? if there is mismatch then the notification may not trigger. Also pass harcoded value in notification for the sake of testing.