<div>Thanks for the help.  I was able to make the scrip below work.</div>
<div> </div>
<div>The scrip was able to merge new ticket with Subject: "Test Ticket Subject" to an existing ticket with the same subject. </div>
<div><br>Just few more questions: </div>
<div>- what to add on the scrip to ignore preceeding characters such as RE: and FWD:? A new ticket with subject: "RE:  Test Ticket Subject" to an existing ticket with the same subject </div>
<div>- the scrip does not merge new ticket with subject: "** PROBLEM alert - Saturn backup server/DNS is CRITICAL **" to an existing ticket with the same subject. Is there a syntax that I need to add for this? </div>

<div>  </div>
<div>All help will be greatly appreciated.</div>
<div> </div>
<div><br>Thanks!</div>
<div>===== </div>
<div>my $problem_desc = undef;</div>
<div>my $Transaction = $self->TransactionObj;<br>my $subject = $Transaction->Attachments->First->GetHeader('Subject');</div>
<div>$problem_desc = $subject;<br>$RT::Logger->debug("This is the subject to match: $problem_desc");</div>
<div># look for subject on existing tickets <br>my $search = RT::Tickets->new($RT::SystemUser);<br>$search->LimitQueue(VALUE => 'IT');<br>$search->LimitStatus(VALUE => 'new', OPERATOR => '=', ENTRYAGGREGATOR => 'or');<br>
$search->LimitStatus(VALUE => 'open', OPERATOR => '=');</div>
<div>if ($search->Count == 0) { return 1; }<br>my $id = undef;<br>my $same_desc = undef;<br>while (my $ticket = $search->Next) {<br>    # Ignore this ticket that opened this transaction <br>    next if $self->TicketObj->Id == $ticket->Id;<br>
    $same_desc=$ticket->Subject;<br>   #if ($same_desc eq $problem_desc){<br>   if ($problem_desc eq $same_desc){<br>       # Found the same subject <br>       $RT::Logger->debug("SAME $same_desc and $problem_desc");  <br>
       $id = $ticket->Id;<br>       $RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . " into $id because of OA number match.");<br>       $self->TicketObj->MergeInto($id);<br>
    } <br>}</div>
<div>$id || return 1;<br>1;</div>
<div><br> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div><br> </div>
<div class="gmail_quote">On Fri, Aug 14, 2009 at 9:41 AM, Rémi <span dir="ltr"><<a href="mailto:mirebob@gmail.com">mirebob@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">hi 
<div><br></div>
<div>try using <span style="FONT-FAMILY: monospace; WHITE-SPACE: pre; FONT-SIZE: 13px">$TicketObj->SetSubject() function,</span></div>
<div><span style="FONT-SIZE: 13px"></span><font face="monospace"><span style="WHITE-SPACE: pre"><span style="FONT-FAMILY: sans-serif; WHITE-SPACE: normal; FONT-SIZE: 13px"><pre>$TicketObj->Subject is just an accessor method</pre>
<pre>Rémi</pre></span></span></font>
<div><br>
<div class="gmail_quote">2009/8/13 rmp dmd <span dir="ltr"><<a href="mailto:rmp.dmd1229@gmail.com" target="_blank">rmp.dmd1229@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div class="h5">
<div>Hi,</div>
<div> </div>
<div>I'm using the scrip below to merge newly created ticket with existing ticket with the same subject. However, im getting</div>
<div> </div>
<div>Scrip 36 Commit failed: Can't modify non-lvalue subroutine call at (eval 1311) line 21.</div>
<div> </div>
<div>code for line 21 is : </div>
<div>$ticket->Subject = $same_desc;</div>
<div> </div>
<div>Im not exactly sure what the error means. Please help in making the scrip work. </div>
<div> </div>
<div> </div>
<div>Thanks!</div>
<div> </div>
<div> </div>
<div> </div>
<div>====</div>
<div> </div>
<div>my $problem_desc = undef;</div>
<div>my $Transaction = $self->TransactionObj;<br>my $subject = $Transaction->Attachments->First->GetHeader('Subject');</div>
<div>$problem_desc = $subject;<br>$RT::Logger->debug("This is the subject to match: $problem_desc");</div>
<div># look for subject on existing tickets <br>my $search = RT::Tickets->new($RT::SystemUser);<br>$search->LimitQueue(VALUE => 'IT');<br>$search->LimitStatus(VALUE => 'new', OPERATOR => '=', ENTRYAGGREGATOR => 'or');<br>
$search->LimitStatus(VALUE => 'open', OPERATOR => '=');</div>
<div>if ($search->Count == 0) { return 1; }<br>my $id = undef;<br>my $same_desc = undef;<br>while (my $ticket = $search->Next) {<br>    # Ignore this ticket that opened this transaction <br>    next if $self->TicketObj->Id == $ticket->Id;<br>
    $ticket->Subject = $same_desc;<br>    if ($same_desc eq $problem_desc){<br>       # Found the same subject <br>       $RT::Logger->debug("SAME $same_desc and $problem_desc");  <br>       $id = $ticket->Id;<br>
       $RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . " into $id because of OA number match.");<br>       $self->TicketObj->MergeInto($id);<br>    } <br>}</div>
<div>$id || return 1;<br>1;<br>     <br></div><br></div></div>_______________________________________________<br><a href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users" target="_blank">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a><br>
<br>Community help: <a href="http://wiki.bestpractical.com/" target="_blank">http://wiki.bestpractical.com</a><br>Commercial support: <a href="mailto:sales@bestpractical.com" target="_blank">sales@bestpractical.com</a><br>
<br><br>Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<br>Buy a copy at <a href="http://rtbook.bestpractical.com/" target="_blank">http://rtbook.bestpractical.com</a><br></blockquote></div><br>
</div></div></blockquote></div><br>