TrackStudio Enterprise 3.5
Add Message / BEFORE:

The following trigger tracks custom field value changes in the message description:

if (message.getUdfValues()!=null && !message.getUdfValues().isEmpty()) {
    StringBuffer sb = new StringBuffer( 32 );
    for (Iterator it=message.getUdfValues().keySet().iterator();it.hasNext();) {
    String key = it.next().toString();
    String value = message.getUdfValues().get(key).toString();
    String oldValue = AdapterManager.getInstance().getSecuredUDFAdapterManager()
        .getTaskUDFValue(message.getSecure(),message.getTaskId(),key);
    if ((oldValue!=null && !oldValue.equals(value))
        || (oldValue==null && value!=null)) {
        if (sb.length() == 0) {
           sb.append("<b>");
        }
        sb.append("'").append(key).append(" changed from ")
          .append(oldValue).append(" to ").append(value).append("<br/>").append("\n");
    }
    }
    if (sb.length() >0) {
    sb.append("</b><br/><hr/><br/>\n").append(message.getDescription());

    return new SecuredMessageTriggerBean(message.getId(), sb.toString(),
                         message.getTime(), message.getHrs(), message.getDeadline(),
                         message.getBudget(), message.getTaskId(), message.getSubmitterId(),
                         message.getResolutionId(), message.getPriorityId(), null,
                         message.getHandlerUserId(), message.getHandlerGroupId(),
                         message.getMstatusId(), message.getUdfValues(), message.getSecure());
    }
}
return message;