[rt-users] Routing New Requests by Time
AJ Ferrigno
aj.ferrigno at gmail.com
Wed Jun 2 12:51:00 EDT 2010
Hello,
I'm on RT 3.8.8. I have a need to route newly created requests for a
specific queue to a certain owner depending on time of day. I've
created a custom scrip that seems like it should work, but it is
hanging on the "date" call. The log tells me: Can't locate object
method "date" via package "Class::Date" (perhaps you forgot to load
"Class::Date"?
My scrip code is below:
my $createddate = Class::Date::date $self->TicketObj->Created;
if ($self->TicketObj->Created->hour >= 17)
{$self->TicketObj->SetOwner('user1');}
elsif ($createddate->hour >= 15) {$self->TicketObj->SetOwner('user2');}
elsif ($createddate->hour >= 13) {$self->TicketObj->SetOwner('user3');}
elsif ($createddate->hour >= 11) {$self->TicketObj->SetOwner('user4');}
elsif ($$createddate->hour >= 9) {$self->TicketObj->SetOwner('user5');}
I also tried to call $self->TicketObj->Created->hour, but it seems the
"Created" property doesn't return a true Perl datetime object? So I
decided to try it this way.
First of all - is this the best way to handle something like this?
Second, I'm using the web interface to paste this code into the
"Custom action preparation code:" section. How do I include a Perl
"use" directive? Do I need to make this scrip an actual perl file on
the server somewhere to do this? (Where would that be?)
Thanks in advance,
AJ
More information about the rt-users
mailing list