Close Task via Email

SimonRudd
Kilo Explorer

Hi All,

 

To make life easier for our Service Desk, we would like the option to close tasks via an email response (similar to approvals). The idea is that the Service Desk would receive an email saying that a task is assigned to them and they have the option to either Close Complete or Close Reject.

This is based on Requests (REQ -> RITM -> TASK) and we would want the TASK to be closed.

I have tried creating an email template (using the 'mailto: approval' template as a base) and also an inbound action based on type being 'reply' and the table being task or catalog task. I have tried the following scripts, as found on the community, as an inbound action and neither work on the task or catalog task tables (these scripts are based just on close completing, to start)

SCRIPT 1

var temp =email.subject.toString().toLowerCase();

if(temp.indexOf("close task") > 0)

current.state= 3; //closed state

current.update();

SCRIPT 2

gs.include('validators');  

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

if (email.subject.toLowerCase().indexOf("close task") >= 0) {  

current.incident_state= 3;

current.incident_state.setValue(3);

current.active= false;

current.work_notes= "The caller agreed that this issue was resolved";

}  

current.update();              

}

Is there something obviously wrong and/or is there an easier way to implement this functionality.

Any help or advice would be greatly appreciated.


Simon

10 REPLIES 10

AbhishekGardade
Giga Sage

Hello Simon,

Any time you see string1.indexOf("string2") it is checking the position of "string2" in "string1". If it's not found, it returns -1 because 0 is the first position.

f(temp.indexOf("close task") >= 0)

current.state= 3//closed state

current.update();

on which table you have written a inbound action?

Thanks,

Abhishek

Thank you,
Abhishek Gardade