Scrips...change due date on queue change

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,
($hoursuntildue6060));
$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

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

If I place my $curtime=time; it will work.

You probably want $self->TicketObj->CreatedObj->Unix.

Refer to RT::Date - RT 4.0.25 Documentation - Best Practical or perldoc /opt/rt4/lib/RT/Date.pm.

I have tried:
my $curtime = $self->TicketObj->CreatedObj;

This returns an RT::Date object.

and
my $curtime = $self->TicketObj->CreatedObj->AsString;

This returns a localized string.

You may also be interested in looking at RT::Extension::SLA, which adds
business hour calculations to ticket due dates based on SLAs you define.