[rt-users] Scrip for escalating priority based on to address from header

Todd Chapman todd at chaka.net
Wed Jan 30 15:22:38 EST 2008


Kimberly,

I would starting by picking up a copy of Learning Perl. If you don't know
basic Perl syntax there is no way you will be able to write RT scrips. Try:

if ($to =~ /xxx\-alert\@.*\.?tivo\.com/) {
{
$self->TicketObj->SetPriority(98);
}

I'll write it for you if you send me an HD Tivo. ;)

-Todd


On 1/30/08, Kimberly McKinnis <kmckinnis at tivo.com> wrote:
>
>  Because I have no idea what I'm doing. Without, I still receive errors:
>
> [Wed Jan 30 20:17:14 2008] [error]: Scrip 16 Commit failed: Global symbol
> "$to" requires explicit package name at (eval 2305) line 1.
> Global symbol "$Ticket" requires explicit package name at (eval 2305) line
> 1.
> syntax error at (eval 2305) line 2, near "if $to "
> Global symbol "$to" requires explicit package name at (eval 2305) line 2.
>  (/usr/lib/rt/RT/Action/UserDefined.pm:81)
>
>  ------------------------------
> *From:* Todd Chapman [mailto:todd at chaka.net]
> *Sent:* Wednesday, January 30, 2008 11:58 AM
> *To:* Kimberly McKinnis
> *Cc:* rt-users at lists.bestpractical.com
> *Subject:* Re: [rt-users] Scrip for escalating priority based on to
> address from header
>
> Why do you have a package statement?
>
> And $Ticket should be $self->TicketObj.
>
> On 1/30/08, Kimberly McKinnis <kmckinnis at tivo.com> wrote:
> >
> >  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.
> >
> > I've approached this with a user defined scrip in the server queue:
> >
> > Custom condition: return 1;
> >
> > Custom action prep code: return 1;
> >
> > Custom action cleanup code:
> >
> > package RT::User;
> >
> > my $to = $Ticket->Transactions->First->Message->First->GetHeader('To');
> > if $to = ('xxx\-alert\@.*\.?tivo\.com')
> > {
> > $self->TicketObj->SetPriority(98);
> > }
> > return 1;
> >
> > When opening a new ticket, I see in rt.log:
> > [Wed Jan 30 18:56:16 2008] [error]: Scrip 16 Commit failed: Global
> > symbol "$to" requires explicit package name at (eval 2242) line 3.
> >
> > Global symbol "$Ticket" requires explicit package name at (eval 2242)
> > line 3.
> > syntax error at (eval 2242) line 4, near "if $to "
> > Global symbol "$to" requires explicit package name at (eval 2242) line
> > 4.
> >  (/usr/lib/rt/RT/Action/UserDefined.pm:81)
> >
> > 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!
> >
> > ~~
> > Kimberly McKinnis
> > System Operations Engineer
> > Service Provider Division, TiVo Inc
> > 408-519-9607
> >
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Community help: http://wiki.bestpractical.com
> > Commercial support: sales at bestpractical.com
> >
> >
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> > Buy a copy at http://rtbook.bestpractical.com
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080130/b8fd3c2b/attachment.htm>


More information about the rt-users mailing list