Setting new ticket Priority: $self->setPriority doesn't work

I’m trying to set a new, incoming ticket’s priority based on a line in
the actual body of the ticket that looks something like this:

Priority: 75

It appears to me that if I could get that line in the HEADER of the
message, then it might get set automatically. But I can’t…the thing
sending the e-mail is a little limited as to what it can do.

So I’ve made a custom Scrip action and modeled it after some other Scrip
actions I found on the Wiki. Sadly, it doesn’t work.

Here’s the code:

sub ExtractBuiltinFieldValues
my $self = shift;

$RT::Logger->debug("In ExtractBuiltinFieldValues");

my $AttachObj = $self->TransactionObj->Attachments->First;
# go out if content is not text!
unless( $AttachObj->ContentType =~ /^text/ ) {

    return 1;

my $content = $AttachObj->Content;
if( $content =~ m/^\QPriority:\E\s*(\S+)\s*$/m ) {

    $RT::Logger->debug("SetPriority :$1:");
    $self->TicketObj->SetPriority( $1 );


And here’s where the errors start:

[Wed Jun 1 18:36:38 2005] [debug]: SetPriority :75:
[Wed Jun 1 18:36:38 2005] [warning]: DBD::Pg::st execute failed: ERROR:
invalid input syntax for integer: “Priority” at /usr/lib/perl5/site_
perl/5.8.5/DBIx/SearchBuilder/ line 480.

From then on there’s just a cascade of errors, as the rest of the
queries don’t work.

I’m open for suggestions on a better way to do this.

It has occurred to me as I write this that called “SetPriority” invokes
all the DBIx and actually tries to update the ticket in the table, but
at this early state, the ticket might not actually EXIST in the table
yet, causing this failure. Is that it? Should I be using something
other than SetPriority?



This communication may contain privileged and/or confidential information. It
is intended solely for the use of the addressee. If you are not the intended
recipient, you are strictly prohibited from disclosing, copying, distributing
or using any of this information. If you received this communication in error,
please contact the sender immediately and destroy the material in its entirety,
whether electronic or hard copy. You may not directly or indirectly reuse or
redisclose such information for any purpose other than to provide the services
for which you are receiving the information.

Telsource Corporation
8237 Dow Cir, Strongsville, OH 44136