[rt-users] email ticket updates...

Stephen Turner sturner at MIT.EDU
Thu Nov 6 10:07:18 EST 2008

On Thu, 06 Nov 2008 09:45:00 -0500, Lars Kellogg-Stedman <lars at oddbit.com>  

>> Is there a way that when a ticket comes in via email I can look to see  
>> if it
>> has some information in the subject so it will just update the already
>> created ticket?
> Create a custom field called something like "external ticket id".
> Add an "On Create" scrip such that when email comes in from the
> proprietary ticket system:
> (a) The scrip extracts the ticket id from the email.
> (b) The script searches for a ticket that has the same value in the
> "external ticket id" field.
> (c) If it finds a matching ticket, the email is appended to the ticket,  
> or
> (d) If it does not find a matching ticket, a new ticket is created
> with the "external ticket id" field appropriately populated.
> Having not actually tried to implement this, I'm a little uncertain
> about the specifics of (c).  You may find that this step means "copy
> the email content to the target ticket, and then mark the current
> ticket resolved/deleted/etc".

This could work - although be aware that this will always create a new  
ticket in your RT. If you delete it in the scrip as Lars suggests, that  
may not be an issue for you. Appending to the other ticket would mean  
calling the Correspond method on that ticket using the incoming email data.

A possible problem here is that the functionality is obscure - it's buried  
in the scrip code, and an admin in the future may not be aware that it's  
there. If someone adds a new 'on create' scrip to autoreply to requestors  
for example, you'd have notifications being sent to customers from a  
deleted ticket, which may be confusing.

An alternative approach might be to modify the code in  
lib/RT/Interface/Email.pm (Gateway method). This is where RT examines  
incoming mail to decide whether to create a new ticket or append to an  
existing one. You can add code here to examine the incoming subject line  
and see if it matches an existing RT ticket or not.


Stephen Turner
Senior Programmer/Analyst - SAIS

More information about the rt-users mailing list