<div>Thank you very much Raed. </div>
<div> </div>
<div>This problem explains while I merging the newly created tickets to a ticket with status 'new' on the top of the list. </div>
<div> </div>
<div>I need to merge new ticket to an existing ticket with subject matching ** PROBLEM - any words - CRITICAL ** .</div>
<div> </div>
<div>1st request, this is a match: <span class="title">#2316: </span>** PROBLEM alert - Echo PC02/check_usa is CRITICAL ** </div>
<div>2nd request, this is a match: <span class="title">#2317: </span>** PROBLEM alert - Echo PC02/check_usa is CRITICAL ** </div>
<div><span class="title"></span> </div>
<div>The existing ticket has an ID: 2312 with Subject: ** PROBLEM alert - Echo PC02/check_usa is CRITICAL ** </div>
<div> </div>
<div>I will merge ticket 2316 and 2317 with 2312. </div>
<div> </div>
<div>Somehow this merge to a ticket DRP with ID 720. This is ticket is on the top of IT queue list</div>
<div> </div>
<div>223 Centralize Sever login open IT <br>668 test on Saturn open IT <br>720 DRP new IT <br>745 Backup - all corporate open IT <br>873 Image Ken Gen open IT<br>1135 DSS-3 tapes new IT </div>
<div> </div>
<div>Below is the script. I hope somebody can help.</div>
<div> </div>
<div>Thanks!</div>
<div>Roehl</div>
<div> </div>
<div>my $oa = undef; </div>
<div>my $Transaction = $self->TransactionObj; <br>my $subject = $Transaction->Attachments->First->GetHeader('Subject'); <br>if ( $subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {<br>$oa = $1; <br>
#$RT::Logger->debug("Found oa: $oa"); <br>} <br>else { return 1; } </div>
<div><br>my $TicketsObj = RT::Tickets->new($RT::SystemUser); <br>$TicketsObj->LimitQueue(VALUE => 'IT'); <br>$TicketsObj->LimitStatus(VALUE => 'new');<br>$TicketsObj->LimitStatus(VALUE => 'open');</div>
<div> </div>
<div> </div>
<div>if ($TicketsObj->Count == 0) { return 1; } <br>my $id = undef; <br>while (my $ticket = $TicketsObj->Next) { <br>next if $self->TicketObj->Id == $ticket->Id; <br>$id = $ticket->Id; <br>last; <br>} </div>
<div>$id || return 1; </div>
<div>$RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . " into $id because of OA number match."); <br>$self->TicketObj->MergeInto($id); <br>1; </div>