Hi.
I'm trying to set the due date on a child dependant ticket
when the parent is resolved. I'm able to get it *mostly* working. The
due date is setting itself 24hours in the future, but the due days is
set at 14 in the queue. How can I get the scrip to pickup the queues 14
day duel date?
I think I need to be using something else other than
AddDays($RT::OverdueAfter); Any ideas what I should be using?
The script in its entirety:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/
);
## here you can add any action
## Set status to Open for tickets that depend on resolved ticket
$l->BaseObj->SetStatus('open');
## Add comment to tickets that depend on resolved ticket
my $id = $self->TicketObj->id;
my $status = $self->TicketObj->Status;
$l->BaseObj->Comment(Content => <<END);
This ticket depends on ticket \#$id which was $status.
END
## Sets dates of child ticket if not set.
my $now = RT::Date->new($RT::SystemUser);
my $sla = RT::Date->new($RT::SystemUser);
$now->SetToNow;
$sla->SetToNow;
$sla->AddDays($RT::OverdueAfter);
if ( $l->BaseObj->StartsObj->AsString eq "Not set") {
$l->BaseObj->SetStarts( $now->ISO );
}
if ( $l->BaseObj->StartedObj->AsString eq "Not set") {
$l->BaseObj->SetStarted( $now->ISO );
}
if ( $l->BaseObj->DueObj->AsString eq "Not set") {
$l->BaseObj->SetDue( $sla->ISO );
}
}
$DepOnBy = undef;
return 1;
Thanks,
Alex
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [email protected]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com