[rt-users] scrips...change due date on queue change

Telmo Cardoso telmo.cardoso at gmail.com
Mon Dec 3 13:30:14 EST 2012


Hi again,

I would really like if someone could help me with this question, because
its not hard, but its not working dunno why.

I'm chaging due dates on queue change, based on ticket creation date.

I have the following scrips:
Condition: On Queue Change
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom action cleanup code:
my $duedate = RT::Date->new($RT::SystemUser);
my $hoursuntildue = 27;
if ($self->TicketObj->QueueObj->Name eq "queueName") {
$hoursuntildue = 9;
} else {
$hoursuntildue = 27;
}
use Business::Hours;
my $hours = Business::Hours->new();
my $curtime = $self->TicketObj->CreatedObj->Get( Timezone => 'server' );
my $bus_hours_duetime = $hours->add_seconds ($curtime,
($hoursuntildue*60*60));
$duedate->Set(Format=>'unix', Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
return 1;


This only fails on this line:
my $curtime = $self->TicketObj->CreatedObj->Get( Timezone => 'server' );

If I place my $curtime=time; it will work. I have tried:
my $curtime = $self->TicketObj->CreatedObj;
and
my $curtime = $self->TicketObj->CreatedObj->AsString;

any help?

Thanks


   Telmo Cardoso
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121203/1e934cc9/attachment.htm>


More information about the rt-users mailing list