Recording incoming reply emails to closed cases

Rob Sestito
Mega Sage

Hello SN Comm,

Looking for some scripting help.. I have an inbound email action that I am looking to control a little more.

as of right now, my current inbound email action is called HR Case Update. It helps control incoming emails to NOT change the state of a Case as it was doing before. It also helps control the Accept / Reject Email Notification replies to cases. We have ready but not in prod yet, an email notification that is sent to the end user once a Case worker clicks on 'Resolve Case' button, and sends the Case to 'Awaiting acceptance' state, which triggers the email notification to be sent. To allow the end user to click on one of two URL links to accept or reject the resolution to their case.

With the current inbound email action, it does not record incoming emails when the Case is in 'Closed Complete' (inactive state). I would like to see about modifying this to allow the email to still be recorded when the Case is closed.

Here below is the current inbound email script: (3 = closed completed / 20 = awaiting acceptance / 18 = work in progress)

gs.include('validators');

if (current.getTableName() == "hr_case") {

current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;

}

if(current.state !=3){

if (current.state == 20)

{

//Awaiting Acceptance

if (email.subject.indexOf("Accept") >= 0){

current.state = 3; //Close Complete

}

if (email.subject.indexOf("Reject") >= 0){

current.state = 18; // Work in Progress

}

current.update();

}

}

thanks in advance, hope someone can help out!

-Rob