Need notifications when replies are sent to a case.

brandon_bakowsk
Tera Contributor

Whenever a client replies to a case generated via Email to ticket, I need a notification sent out to the assignee of that case so we don't miss any sort of information, just like how SN notifies us whenever a new comment is added.

I've been plugging away at this via inbound actions and notifications all day and have about hit my limit, I've seen similar posts about such an issue but was hoping someone had an easy solution I just haven't thought of yet.

Is there any easy solution to be notified on "Email received"?

28 REPLIES 28

Brian Lancaster
Tera Sage

Are comments not updated on a case not updated out of the box when a customer replies? I have not use cases yet. Can your provide the code of your inbound action? I would think it would be similar to the incident one just need to point to the the table for cases.

Here is the code for the "Update case via reply" Inbound action:

//if case.state = resloved (6), then check first word in body for accept or reject
//else if case.state = Awaiting (18), then, move to open state
var case_state = current.state;
if (current.state == 6) {
    var lines = email.body_text.split('\n');
    var firstword = "";
    if (lines.length > 0)
        firstword = lines[0].replace(/^\s+|\s+$/g,'');
    firstline = firstword.toLowerCase();
    if (firstline) {
        if(firstline.indexOf("reject") == 0)
            current.state = 10;
        else if(firstline.indexOf("accept") == 0)
            current.state = 3;
    }
} else if (current.state == 18) {
    current.state = 10;
} else{
    current.sys_updated_on = "";
}

current.update();

Customers can comment on a case when signed into SN and that does notify us as an "additional comments added" email notification we get, the issue is if they reply to an email to ticket email that just shows up as an "email received" and doesn't notify anyone.

Yes I see that. I just install CSM on my developer instance. I'm note sure why it was designed that way. There are a couple things here. You can add current.comments = "reply from: " + email.origemail + "\n\n" + emailBody; similar to incident inbound action. Which would then fire the case commented notification just like if they did it via the system.

 

OR

 

You could trigger an event when the case is updated like @MrGupta__ mentioned.

1. First you need to register an event
2. Then you need to create a notification that fires based on that event.

3. You need to use gs.eventQueue to trigger the event via code in the inbound action.

I've attempted to add the code you suggested to the inbound action "update case via reply" but that has not resulted in any emails.

//if case.state = resloved (6), then check first word in body for accept or reject
//else if case.state = Awaiting (18), then, move to open state
var case_state = current.state;
if (current.state == 6) {
    var lines = email.body_text.split('\n');
    var firstword = "";
    if (lines.length > 0)
        firstword = lines[0].replace(/^\s+|\s+$/g,'');
    firstline = firstword.toLowerCase();
    if (firstline) {
        if(firstline.indexOf("reject") == 0)
            current.state = 10;
        else if(firstline.indexOf("accept") == 0)
            current.state = 3;
    }
} else if (current.state == 18) {
    current.state = 10;
} else{
    current.sys_updated_on = "";
}

current.update();

// Trigger a custom event for the email notification
gs.eventQueue('case.email.received', current, current.assigned_to, email.body_text);

This is the current code.