Script: Forcing a Message Type via Email

Discuss problems installing or using TrackStudio.

Script: Forcing a Message Type via Email

Postby RickCogley » Tue Sep 26, 2006 5:13 am

Before, in a previous TS release I worked with Maxim on getting a script working that allowed my team to send emails back to TS, with a "secret code" in them, such as =INTERNAL=, which would force TS to use a particular type of message, when it appends to the workflow.

The below script works as of 4.5.5, and note that you need to specify com.trackstudio.secured before the SecuredMessageTriggerBean. You would create this script and put it in a trigger on the DEFAULT message in your workflow.

This is set in Workflow, Message Types, choose Default Message Type, Trigger, BEFORE trigger. You have to make separate scripts for each workflow (but I figure there must be a nicer way to make one script for ALL workflows that you can then put some logic in, but, I do not know how to do this....).

Below, note:

Searched Secret Code: =INTERNAL=
Workflow: Ticket
Message Type to Add: 000 Memo INTERNAL


Code: Select all
String desc = message.getDescription();
if (desc != null && desc.indexOf("=INTERNAL=") != -1) {
String mtId = CSVImport.findMessageTypeIdByName("000 Memo INTERNAL", "Ticket");
return new com.trackstudio.secured.SecuredMessageTriggerBean(message.getId(), desc, message.getTime(), message.getHrs(), message.getDeadline(), message.getBudget(), message.getTaskId(), message.getSubmitterId(), message.getResolutionId(), message.getPriorityId(), null, message.getHandlerUserId(), message.getHandlerGroupId(), mtId, message.getUdfValues(), message.getSecure());
}
return message;


FYI, hope this helps someone.
Rick Cogley
Tokyo, Japan
RickCogley
 
Posts: 399
Joined: Tue Jul 05, 2005 2:16 pm

Return to TrackStudio Support

Who is online

Users browsing this forum: Google [Bot] and 12 guests

cron