Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Why this inbound email script not working?

JordyZ
Mega Sage

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?)

JordyZ_0-1701094223875.png

And finally the notification to the assignee is configured by taking that same event as activation trigger:

JordyZ_1-1701094323025.png

 

Why is the event in the script not triggered? Without it triggering, the notification won't work.


Thanks in advance

5 REPLIES 5

Hi @JordyZ 

Did you check if your BR is running by putting logs also, check if your event is triggering by looking into event logs

Best Regards
Aman Kumar