[rt-users] Scrip/template "Notify parent ticket owner on resolve"?
Kenneth Crocker
kenn.crocker at gmail.com
Mon Jun 4 15:01:52 EDT 2012
Jeff,
Here's some code I developed for a 3.8 installation.
It will add "TimeWorked" to each parent of a ticket up the ladder and
sideways (if a ticket has more than one parent), regardless of how many.
Use it as an example of how to determine if there is a parent and then as a
condition to send a notification.
Hope this helps.
Kenn
#----------------------------------------------------------------------------
# Custom condition:
#----------------------------------------------------------------------------
# Set initial values
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
# Get out if not for "TimeWorked"
return 0 unless ($trans->Type eq 'Set' &&
$trans->Field eq 'TimeWorked');
return 1;
#----------------------------------------------------------------------------
# Custom action preparation code:
#----------------------------------------------------------------------------
# Set initial values
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $Time = (($trans->NewValue) - ($trans->OldValue));
my $MemberOf = $ticket->MemberOf;
# get out if current ticket is not a "MemeberOf" (child of some parent)
return 0 unless $MemberOf;
# Loop thru each parent and add the Child's "TimeWorked" to them
# You can skip a parent ticket if it is not in active state by uncommenting
# the "next" statement
while( my $l = $MemberOf->Next )
{
# next unless( $l->TargetObj->Status =~ /^(?:new|open|stalled)$/ );
my $ParentTime = $l->TargetObj->TimeWorked;
my $NewTime = ($ParentTime + $Time);
$l->TargetObj->SetTimeWorked($NewTime);
}
return 1;
#----------------------------------------------------------------------------
# Custom action cleanup code: None
#----------------------------------------------------------------------------
return 1;
On Mon, Jun 4, 2012 at 10:04 AM, Jeff Blaine <jblaine at kickflop.net> wrote:
> Does anyone know of a way to notify the parent ticket's owner
> on resolve?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120604/57fbc3d1/attachment.htm>
More information about the rt-users
mailing list