The following trigger tracks custom field value changes in the message description:
if (message.getUdfValues()!=null && !message.getUdfValues().isEmpty()) { String changes=""; 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)) { changes+=key+" changed to "+value+"\n"; } } String newDescription = changes+message.getDescription(); return new SecuredMessageTriggerBean(message.getId(), newDescription, 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;
Copyright (c) 2002-2006. All rights reserved.
|