I’m running RT 4, and we have a external service provider that has
their own RT system. When they create a ticket to us, their RT sends
the notification to the email address associated with our RT. The
problem is that their process is to send a notification on create,
then send a message immediately after with the details. This
generates two tickets in system. Has any one written or modified one
of the scrips to look for an existing ticket with the subject tag from
an external RT system, before creating a new ticket. Basically
implement the similar logic that is used for internal subject tag, but
basically same IF (Ticket with External Tag Exists) → Update Ticket;
Else Create new ticket.
Here’s something we used to use to do this - it does create the second
ticket, but then immediately merges it into the first one. I think I got
it from elsewhere originally (which is why it mention Nagios in the
comments). It looks for certain subject line patterns, then finds
existing tickets with a matching subject line - in this case, it’s
Smokeping alerts, which tend to come in flurries.
Combine with something to suppress auto-replies to mail from your
supplier’s RT system 
Scrip Condition: On Create
Action: User Defined
Template: Blank
Action Prep Code:
1;
Action Code:
If the subject of the ticket matches a pattern suggesting
that this is a SmokePing Alert message AND there is
an existing ticket (open or new) in the “General” queue with a matching
Subject, (that is not this ticket) merge this ticket into that ticket
my $problem_desc = undef;
my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
if ($subject =~ /[SmokeAlert](.*)/) {
# This looks like a SmokeAlert message
$problem_desc = $2;
$RT::Logger->debug("Found a smokealert msg: $problem_desc");
} else {
return 1;
}
Ok, now let’s merge this ticket with it’s PROBLEM msg.
my $search = RT::Tickets->new($RT::SystemUser);
$search->LimitQueue(VALUE => ‘General’);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR =>
‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);
if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {
# Ignore the ticket that opened this transation (the recovery one…)
next if $self->TicketObj->Id == $ticket->Id;
# Look for nagios PROBLEM warning messages…
if ( $ticket->Subject eq $subject) {
$id = $ticket->Id;
$RT::Logger->debug(“Merging ticket " . $self->TicketObj->Id
. " into $id because of subject match.”);
$self->TicketObj->MergeInto($id);
}
}
$id || return 1;
1;
–
It is all fun and games till flying monkeys attack
Ain’t that the truth 
Howard Jones UK Datacentre NOC Team Virtustream, Inc. 227 Berwick Avenue
| Slough | Berkshire | SL1 4QT Office: +44 (0) 208.230.2105 | Fax: +44
(0) 208.230.2101 howard.jones@virtustream.com | www.virtustream.com