<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Scrip for escalating priority based on to address from header</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I've read up on priorities, but nothing I've seen quite fits my need. We have two email addresses that both go to the same queue, an alert email and a support email. The alert email also SMS's my mobile phone. I'd like to have RT check the to: address from the header and set anything to the alert email to a high priority. Then I can do things like a cron to check for untouched emails with a high priority and alert us. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">I've approached this with a user defined scrip in the server queue:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Custom condition: return 1;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Custom action prep code: return 1;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Custom action cleanup code:</FONT>
<BR><FONT SIZE=2 FACE="Arial"> </FONT>
<BR><FONT SIZE=2 FACE="Arial">package RT::User;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">my $to = $Ticket->Transactions->First->Message->First->GetHeader('To');</FONT>
<BR><FONT SIZE=2 FACE="Arial">if $to = ('xxx\-alert\@.*\.?tivo\.com')</FONT>
<BR><FONT SIZE=2 FACE="Arial">{</FONT>
<BR><FONT SIZE=2 FACE="Arial">$self->TicketObj->SetPriority(98);</FONT>
<BR><FONT SIZE=2 FACE="Arial">}</FONT>
<BR><FONT SIZE=2 FACE="Arial">return 1;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">When opening a new ticket, I see in rt.log:</FONT>
<BR><FONT SIZE=2 FACE="Arial">[Wed Jan 30 18:56:16 2008] [error]: Scrip 16 Commit failed: Global symbol "$to" requires explicit package name at (eval 2242) line 3.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Global symbol "$Ticket" requires explicit package name at (eval 2242) line 3.</FONT>
<BR><FONT SIZE=2 FACE="Arial">syntax error at (eval 2242) line 4, near "if $to "</FONT>
<BR><FONT SIZE=2 FACE="Arial">Global symbol "$to" requires explicit package name at (eval 2242) line 4.</FONT>
<BR><FONT SIZE=2 FACE="Arial"> (/usr/lib/rt/RT/Action/UserDefined.pm:81)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Obviously, I'm doing something very wrong, but I'm not clear what. Could someone proofread this and let me know where I've gone wrong? Thanks!</FONT></P>
<P><FONT SIZE=2 FACE="Arial">~~</FONT>
<BR><FONT SIZE=2 FACE="Arial">Kimberly McKinnis</FONT>
<BR><FONT SIZE=2 FACE="Arial">System Operations Engineer</FONT>
<BR><FONT SIZE=2 FACE="Arial">Service Provider Division, TiVo Inc</FONT>
<BR><FONT SIZE=2 FACE="Arial">408-519-9607</FONT>
</P>
</BODY>
</HTML>