[rt-users] Scrip to set child ticket due date on parent resolve
Alex Young
alexyoung at scoutsolutions.co.uk
Wed Jan 14 10:40:26 EST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090114/e52711fe/attachment.htm>
More information about the rt-users
mailing list