TrackStudio Enterprise 3.1
Example 5

Use the e-mail notification rule based on the following script to send e-mail notification only when a handler has been changed. This script will return 1 when you change a handler adding a task or message -- 0 otherwise.

int ret = 0;

Collection messages = task.getMessages();
Collections.reverse(messages);
String oldHandler = task.getParent() != null ? task.getParent().getHandlerId() : "null";

if (messages.isEmpty() && !oldHandler.equals(task.getHandlerId()))
     ret = 1;

for(Iterator it = messages.iterator(); it.hasNext();) {
    String newHandler = it.next().getHandlerId();
    if (newHandler == null) newHandler = "null";
    if (!newHandler.equals(oldHandler)) {
       ret = 1;
    } else {
       ret = 0;
    }
    oldHandler = newHandler;
}
return ret;
Copyright (c) 2002-2005. All rights reserved.