Attachment of properties via javascript


Via Javascript it is possible to attach properties to a todo. These properties allow a deeper control of the workflow.

In the following example we want to retrieve the sender of an incoming e-mail and check whether it is a possible VIP-customer. For such a VIP-customer an appropriate message box will be displayed during the execution of a todo.

In the first step we will add the following Javascript code to the Receive-Action of the corresponding mailbox:

if((toEmail.indexOf("bluma")>-1) || (toEmail.indexOf("bergener")>-1)){
   task.addProperty("VIP-Kunde", "Ja");    
} else {task.addProperty("VIP-Kunde", "Nein");}

The object addProperty attaches an additional property  "VIP-Kunde" to the todo. The senders "bluma" and "bergener" get the status "Ja", for all other senders "Nein".

properties1_d.jpg

In the second step we add the following javascript code to the Close-Action for the group:

var isvip= task.getProperty ("VIP-Kunde");
if (isvip != null && isvip.equals("Ja"))
{
helper.infoMessage("Achtung: VIP-Kunde!");
}

In this script a variable "isvip" is defined which reflects the content of the attached property "VIP-Kunde".

properties_d.jpg

If "VIP-Kunde" has the content "Ja", then a message box appears during the closing of a todo which refers to VIP status:

properties2_d.jpg

     

Child Pages