Why this inbound email script not working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 06:13 AM
Hi,
I have an inbound email script of reply type on the case table. The goal is to send a notification to the assignee whenever a case receives an E-mail (by anyone except the assignee itself).
This is the inbound email action script (the gs.warn returns true, but the event is not triggered):
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var fromEmail = email.from + '';
var assignedToEmail = current.assigned_to.email + '';
var test = fromEmail != assignedToEmail;
// Implement email action here
if (test) {
gs.warn('sending the event: ' + test);
gs.eventQueue('sn_customerservice.case.update_assigned_to', current, current.assigned_to.email, current.number);
}
})(current, event, email, logger, classifier);
The event is registered like this (should the "fired by" be configured?)
And finally the notification to the assignee is configured by taking that same event as activation trigger:
Why is the event in the script not triggered? Without it triggering, the notification won't work.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 06:36 AM
Hi @JordyZ ,
Are you getting gs.warn message in log, if not then change the If condition and check.
if (fromEmail != assignedToEmail) {
gs.warn('sending the event: ' + test);
gs.eventQueue('sn_customerservice.case.update_assigned_to', current, current.assigned_to.email, current.number);
}
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 06:47 AM
Hi @AshishKM ,
Yes the gs.warn message is in the log and it returns true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 07:21 AM
Seems all looks good. Can you try following
1.Notification is active - Just wanted to double check
2.Can you try trigger the same notification with another "valid event" - if this work, then we can say notification is working .
3.Try simulate/create another event(Make sure to be on right scope) and update your script/Notification accordingly. And trigger notification.
Please share us your input, if you fixed in any other way .
Regards,
Luxo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 06:25 AM
Hi @Luxo Nadappan @AshishKM , thanks for replying. In the end, it was just a typo in the event name. Dumb mistake by me.
I have another question. Using the live_notification table, I'm creating a BR that triggers an event whenever @someone is mentioned in activity log. This one also not triggering the event.
It's the right event name this time and the notification is configured correctly. Any ideas?