Automatic responses to emails with existing task-IDs
Normally, in todo4teams internally a new task-ID is generated on arrival of a customer request via e-mail and then communicated to the customer via an automated e-mail reply.
For the case that for a process already a ticket was generated and the customer responded to the initial response mail, it may be useful to not send a new autoreply email and to not inform the customer about the new task-ID. This has the advantage that for the customer the entire process is connected with only one single ticket number.
The relevant functionality is stored in the receive-action of your mailbox. The following JavaScript reads out the header of the customers email and checks whether it is a response on an existing ticket. However, this requires that the customer did not change the subject of the original email reply, because the script reads out if the string "ID: number" is available.
In addition, the internal todo4teams task-IDs are linked; Predecessor and successor can be loaded into the job details within the "workflow" tab. This is particularly helpful for internal processing in todo4teams since all associated task-IDs will be displayed.
{
var idarr = helper.extractByRegExp(subject.toLowerCase(),"\\(id: (\\d.+)\\)",false);
var id=-1;
if (idarr != null && idarr.length>0)
{
id = java.lang.Long.parseLong(idarr[0]);
println ("ID"+id);
var qm = new com.proxemo.todo.bom.ToDoArchiveQueryMap(1);
qm.addNameValue(com.proxemo.todo.bom.ToDoArchiveQueryMap.ID_ATTRIBUTE, id);
var qresult = new com.proxemo.todo.server.action.ToDoQueryArchiveAction().execute(-1, qm);
println("number of results"+qresult.getTasks().size());
if (qresult.getTasks().size()>0)
{
task.setMaster(qresult.getTasks().get(0));
return true;
}
}
return false;
}
Additionally, the following Javasrcipt-code should be inserted within the block of the receive-action of the mailbox that decides, if an auto-reply mail will be sent. Please refer to the relevant tutorials on this subject.
println ("Ticket vorhanden:"+ ticketTrue);
if((head==null || head.length==0) && ticketTrue==false)