[rt-users] Scrip/template "Notify parent ticket owner on resolve"?
Kenneth Crocker
kenn.crocker at gmail.com
Tue Jun 5 18:40:24 EDT 2012
Jeff,
OK. Here's what you do:
Create a Template called "Notify Parents on Resolve".
The Template should have code similar to this (loop thru all parents and
add the Emailaddress of the ticket owner to the "To:" line in the Template)
at the top (test the code to correct my mistakes):
To: {my $parent = $Ticket->MemberOf;);
my $OUTPUT;
while ( my $value = $parent->Next )
{
$OUTPUT .= $value->OwnerObj->EmailAddress;
$OUTPUT .= "<---\n";
}
$OUTPUT;
}
Subject: This Child Ticket has been Resolved
Then create a scrip titled "Notify Parents of Resolved Child".
The code should be like this:
# Condition: User Defined
# Action: Notify Others ("To:" address built by template code in
template below)
# Template: Global template: Notify Parents of Resolved Child
# Stage: TransactionBatch
#----------------------------------------------------------------------------
# Custom condition:
#----------------------------------------------------------------------------
# Set initial values
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $MemberOf = $ticket->MemberOf;
#
# Check for value change on Ticket Status
#
return ($self->TransactionObj->Type eq "Status" &&
$self->TransactionObj->NewValue eq "resolved" &&
$MemberOf);
#----------------------------------------------------------------------------
# Custom action preparation code: None
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Custom action clean-up code: None
#----------------------------------------------------------------------------
Anyway, I just whipped this up and you should verify all the code. The
thing is you want to set a condition that tests that the ticket is being
resolved and it is a child. The template should have code that replaces the
"To:" address with the email address of the owner for any parent above and
that way all parents, grandparents, etc get an email saying that a child
ticket has been resolved. My code may be off but the mechanics should be
correct.
Hope this helps.
Kenn
On Tue, Jun 5, 2012 at 2:48 PM, Jeff Blaine <jblaine at kickflop.net> wrote:
> On 6/5/2012 5:29 PM, Thomas Sibley wrote:
>
> Thanks Thomas
>
>
> Think about it this way. Make your Condition custom "On Resolve + Has
>> Parents"
>>
>
> Right.
>
>
> Then use a standard Notify* action and set the Template on the scrip.
>>
>
> The goal is: On resolve of a child ticket, notify *each parent
> tickets' owner* that the child was resolved.
>
> There is no "standard Notify* action" for "Owners of parent
> tickets", so I'm confused by what you mean there.
>
> You also said "the Template". Are you suggesting that I write
> the logic into a new custom template and force the "To:"
> field there? Or did you intend "the Template" to mean any
> existing template of my choice.
>
> I really don't follow you due to terseness, though I am certainly
> not looking for anyone to provide the code either.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120605/fa8ba26c/attachment.htm>
More information about the rt-users
mailing list