External forwarding within scripts
In the following tutorial we would like to show you how a job, that has been generated by an incoming e-mail, can be forwarded without the need of a user dealing with it..
The following script fragment is anchored in the start-action of the relevant mailbox of todo4teams. This fragment performs the following:
- It will be checked whether one or more keywords occur in the header ("Subject") or in the mail text ("Object") of the incoming e-mail, in the present case this is "email campaign".
- If this is the case, the incoming message is forwarded directly to an external recipient, in this case "marcus.hugo@bergener-bluma.de".
- In the corresponding job in todo4teams the finishing remark will be set to "Weiter!"
You can tailor this procedure exactly to your requirements, for help with the details please contact us at support@bergener-bluma.de by mail.
if(message.getSubject().indexOf("email campaign")>-1 || message.getObject().indexOf("email campaign")>-1)
{
var source = task.getSource().getSourcemailbox();
var container = source.createContainer();
container.setTask(task);
container.setTo("marcus.hugo@bergener-bluma.de");
task.getSource().setSendReply(true);
task.setDoneComment("Weiter!");
var ts = new com.proxemo.todo.bom.ToDoTaskShell(task);
new com.proxemo.todo.server.action.ToDoForwardExternalTaskAction().execute(-1, ts);
}
{
var source = task.getSource().getSourcemailbox();
var container = source.createContainer();
container.setTask(task);
container.setTo("marcus.hugo@bergener-bluma.de");
task.getSource().setSendReply(true);
task.setDoneComment("Weiter!");
var ts = new com.proxemo.todo.bom.ToDoTaskShell(task);
new com.proxemo.todo.server.action.ToDoForwardExternalTaskAction().execute(-1, ts);
}
This action is usually started manually as described here.