Testing for certain attachments
This tutorial shows a solution to the following task:
Incoming emails should be checked to see whether certain files are present as attachments.
Further actions are then performed based on the result from this test which evaluates if a pdf is attached to the email. Any other type of file format may be used a parameter instead. In the following example the title of the ticket in todo4teams is changed and informations are written concerning the identified e-mail attachment in the new title of the ticket.
The corresponding Java Script is as follows:
for(ai=0;ai<helper.attachments.length;ai++)
{
var attachment = helper.attachments[ai];
if(attachment.attachmentName.endsWith("pdf")){
// do something...
hasPDF=true;
}
}
if(hasPDF){
task.title="With PDF attachment: "+task.title;
}