Co-operating with Remedy - find ticket when other party does not inlude the RT ticket ID

Hi!

We have a customer using Remedy, another ticketing system. The customer creates the tickets in their system, and it sends an email. Whenever they reply, the subject just cointains their subject, and never keeps the RT#12345 part. Hence, every reply creates a new entry in RT.

In short, is there a way to use a regex like ‘INC[0-9]+’ and match with subject of ticket, so RT will not create duplicate tickets?

Example:

  1. customers sends an email with subject “INC958034”
  2. RT creates a ticket 12355 and replies with subject “[rt#12355] INC958034”
  3. Customer then creates a reply and their system replies with subject “INC958034”
  4. RT creates a new ticket and 12356 and replies “[rt#12355] INC958034”

It gets worse. When the customer closes the ticket in their end and we after that close the ticket in RT:

  1. RT sends an email with subject “[rt#12355] INC958034”
  2. Remedy replies with subject “Ticket INC958034 is closed”
  3. RT creates a new ticket 12357 and replies “[rt#12357 INC958034”
  4. Remedy replies with subject “Ticket INC958034 is closed”
  5. RT creates a new ticket 12358 and replies “[rt#12358 INC958034”
  6. Remedy replies with subject “Ticket INC958034 is closed”
  7. RT creates a new ticket 12359 and replies “[rt#12359 INC958034”
  8. Remedy replies with subject “Ticket INC958034 is closed”

… and we have an email loop.

What you’d like to do, for the part about parsing out an RT ID from the other systems format is overlay the function that handles parsing the ID from the email subject. Create /opt/rt5/local/lib/RT/Interface/Email_Vendor.pm:

package RT::Interface::Email;

use strict;
use warnings;
no warnings 'redefine';

sub ExtractTicketId {
    my $entity = shift;
    my $subject = Encode::decode( "UTF-8", $entity->head->get('Subject') || '' );
    chomp $subject;
    my $id = ParseTicketId( $subject, $entity );

    # Do something here?
}

1;

Great, that’s a good start. I have a FreeBSD installation, so my RT is not in /opt/rt5. Should it be in the same directory as Interface/Email.pm?

No, you need to work out where your installation puts its local stuff, otherwise your changes will get blown away on upgrades. In other words look for the equivalent of the /opt/rt5/local directory hierarchy on your set up.

You can check Admin->Tools->System configuration for “RT::LocalLibPath”