TrackStudio Enterprise 3.5
Add Message / INSTEAD OF:

The following trigger implements the ability to vote for a task by adding a message. To use this script, create a custom field votesCounter of type Integer that will be used to count votes. Assign this trigger for a message type used to vote.

String udfValue = AdapterManager.getInstance().getSecuredUDFAdapterManager()
   .getTaskUDFValue(message.getSecure(), message.getTaskId(),"votesCounter");
String vote="0";
if (udfValue!=null && udfValue.length()>0)
   vote = udfValue;
int v = Integer.parseInt(vote);
v++;
AdapterManager.getInstance().getSecuredUDFAdapterManager().setTaskUDFValueSimple(
  message.getSecure(), message.getTaskId(),"votesCounter", v+"");
return message;