[rt-users] help in creating Scrips

rmp dmd rmp.dmd1229 at gmail.com
Thu Jun 11 15:44:05 EDT 2009


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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090611/c9d29db7/attachment.htm>


More information about the rt-users mailing list