Email notification - additional comments added

LJ_23
Tera Contributor

Hi team, I'm trying to set up an email notification that triggers when an Additional Comment is added to a GFS case. The goal is to notify the (assigned to) 

 

Table: x_lbg_fbs_case_fbs_case

When: After , Insert, 

Filter Conditions: additional comments changes

 

Script:

(function executeRule(current, previous /*null when async*/) {
    // Get the case record from table
    var caseRecord = new GlideRecord('x_lbg_fbs_case_fbs_case');
    if (caseRecord.get(current.element_id)) {
        // Que email notification trigger from event
        gs.eventQueue('x_lbg_fbs_case.comments.added.to.gfs.cas', caseRecord, caseRecord.assigned_to.email, current.value);
    }
})(current, previous);
 
On the email notification:
Table: x_lbg_fbs_case_fbs_case
Triggered by event: x_lbg_fbs_case.comments.added.to.gfs.cas
Who will receive: Assigned to 
 
Please let me know where there is any discrepancies? 
4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @LJ_23 

 

https://www.servicenow.com/community/developer-forum/email-notification-when-additional-comment-is-a...

 

https://www.servicenow.com/community/developer-forum/how-to-send-notification-when-additional-commen...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Mark Manders
Mega Patron

Why not just trigger the notification on 'comments changes' (see OOB 'Incident commented for ITIL' notification). Set the 'who will receive' to 'assigned to' and uncheck the 'send to event creator' to prevent they receive an email from their own comments.

No need for any scripting.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Manmaya Kumar S
Tera Expert

Hi @LJ_23 
Okay, It seems like your BR is triggering on 'insert'. shouldn't it be on 'update' instead?
I think everything is there, you can probably do some cross checking like if the event is firing correctly or not, scopes that are involved etc.

Since its a non global scope, I would prefer segregating the even triggering part in a separate script include created in the global scope.

Let me know if it worked after changing the 'When' value on BR.

Thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

@LJ_23 

2 ways

1) Directly use Notification similar to incident commented for your table

AnkurBawiskar_1-1739283302157.png

 

OR

2) Use flow designer to send email

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader