Thank you very much Raed.

This problem explains while I merging the newly created tickets to a ticket
with status 'new'  on the top of the list.

I need to merge new ticket to an existing ticket with subject matching **
PROBLEM - any words - CRITICAL ** .

1st request, this is a match: #2316: ** PROBLEM alert - Echo PC02/check_usa
is CRITICAL **
2nd request, this is a match: #2317: ** PROBLEM alert - Echo PC02/check_usa
is CRITICAL **

The existing ticket has an ID: 2312 with Subject: ** PROBLEM alert - Echo
PC02/check_usa is CRITICAL **

I will merge ticket 2316 and 2317 with 2312.

Somehow this merge to a ticket DRP with ID 720.  This is ticket is on the
top of IT queue list

223 Centralize Sever login   open IT
668 test on Saturn             open  IT
720 DRP                           new  IT
745 Backup - all corporate  open  IT
873 Image Ken Gen           open  IT
1135 DSS-3 tapes             new  IT

Below is the script.  I hope somebody can help.

Thanks!
Roehl

my $oa = undef;
my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader('Subject');
if ( $subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
$oa = $1;
#$RT::Logger->debug("Found oa: $oa");
}
else { return 1; }

my $TicketsObj = RT::Tickets->new($RT::SystemUser);
$TicketsObj->LimitQueue(VALUE => 'IT');
$TicketsObj->LimitStatus(VALUE => 'new');
$TicketsObj->LimitStatus(VALUE => 'open');


if ($TicketsObj->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $TicketsObj->Next) {
next if $self->TicketObj->Id == $ticket->Id;
$id = $ticket->Id;
last;
}
$id || return 1;
$RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . " into $id
because of OA number match.");
$self->TicketObj->MergeInto($id);
1;
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to