Creating email threads
In todo4teams, this can be easily set up by specifying the ticket ID in the subject line of the messages sent by todo4teams. You can do this by saving the value Re: %SUBJECT (ID: %TICKETID) in the system parameters as the value for the key REPLY_SUBJECT_FORMAT, for example.
E-mail replies from todo4teams always have Re: as the subject, followed by the subject of the sent message and e.g. (ID: 423123), as a reference to the ticket for this e-mail.
If the customer replies to your return e-mail, todo4teams can link this new e-mail to their first e-mail, provided they used the reply function of their e-mail program and the reference via the subject was retained.
The following piece of script code creates this ticket reference and groups the tickets into a common workflow:
{
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;
}
var isFollowUpTicket = ticketExists(message.getSubject());
The script extracts the ticket ID from the subject line of the incoming email and starts an archive search for the original ticket. If this is found, both tickets are grouped into a workflow using the task.setMaster(parentTask) call.
In the ticket details, you can then simply display the email dialog with the customer in the Workflow tab.
The script function shown above has another use: Using the result stored in the isFollowUpTicket variable, you can decide whether you want to send the customer another automatic email reply. In longer dialogs, it hardly makes sense to confirm receipt of each of the customer's emails. It is sufficient to do this with the first email, i.e. if isFollowUpTicket==false.