Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Autoreply email on closed csm cases

Julia Howells
Giga Guru

Hello SN Community! 

When a sn_customerservice_case is closed and a client responds to an email, they should receive a notification back to them that their case has already been closed.

I have an inbound action setup:

With the following code under 'action': 

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

    gs.include('validators');
    if (current.getTableName() == 'sn_customerservice_case') {
        if (current.active == 'false') {

            gs.eventQueue('sn_customerservice.case_closed_email', record, '', gs.getUserName());
        }
    }
})(current, event, email, logger, classifier);

 

When I run a test, however, I get an an error:

And it doesn't trigger the event (which would then trigger the notification that tells the client the case was already resolved). 

Any ideas?

1 ACCEPTED SOLUTION

Jason Nichols
ServiceNow Employee
ServiceNow Employee

Hi Julia,

Is Action type = Record Action? Perhaps this is the cause, in spite of your script not changing the record and only triggering an event. Action Type = Reply Email would send a mail, but the email would be defined in the inbound action, rather than triggering a notification, and I don't think you can use a script. 

You could try Flow Designer instead. Select Inbound Email as the trigger and use the Create Record action to create a log entry in the sysevent table.

View solution in original post

5 REPLIES 5

Jason Nichols
ServiceNow Employee
ServiceNow Employee

Hi Julia,

Is Action type = Record Action? Perhaps this is the cause, in spite of your script not changing the record and only triggering an event. Action Type = Reply Email would send a mail, but the email would be defined in the inbound action, rather than triggering a notification, and I don't think you can use a script. 

You could try Flow Designer instead. Select Inbound Email as the trigger and use the Create Record action to create a log entry in the sysevent table.