Send Notify except if Owner Nobody?

Hi everyone,

I know there’s a way to do this, but I’m still learning RT, so I don’t
know exactly how to code this… I’d like to send an e-mail for a new
ticket to a group, if the owner is Nobody, and send it to the owner if
the owner is NOT Nobody. Right now I have a generic e-mail scrip…

The scrip:
On Create Send Email with template Added to Queue Email

The template (Added to Queue Email):To: group-list@company.com
Subject: {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue.

-> Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->Content()}

So I guess I’m looking to change the template to something like:

—BEGIN—
if owner eq Nobody {
To: group-list@company.com
Subject: {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue.

} else {
To: owner->email
Subject: Your Ticket in {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue and assigned to you.

}

→ Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->Content()}
—BEGIN—

What do you think?

Thanks!
js.
Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net

Arg! This is really frustrating. Using examples found here and there, I
tried this, but it doesn’t work…

—BEGIN-TEMPLATE—
{
my ($to, $for, $msg);
if ($Ticket->OwnerObj->Name eq “Nobody”) {
$to = “support-unix@m-x.ca”;
} else {
$to = $Ticket->OwnerObj->EmailAddress;
$for = " for “.$Ticket->OwnerObj->Name;
}
$msg .= To: $to\n”;
$msg .= “Subject: $Ticket->QueueObj->Name() Queue $for:
$Ticket->Subject()\n\n”;
$msg =. “Ticket #$Ticket->id $for has been added to the
$Ticket->QueueObj->Name() queue.\n”;
$msg;
}

→ Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->Content()}
—END-TEMPLATE—

Does anyone see where the problem might be?..

Thanks!
js.On Mon, Mar 03, 2008 at 01:43:17PM +0000, Jean-Sebastien Morisset wrote:

Hi everyone,

I know there’s a way to do this, but I’m still learning RT, so I don’t
know exactly how to code this… I’d like to send an e-mail for a new
ticket to a group, if the owner is Nobody, and send it to the owner if
the owner is NOT Nobody. Right now I have a generic e-mail scrip…

The scrip:
On Create Send Email with template Added to Queue Email

The template (Added to Queue Email):
To: group-list@company.com
Subject: {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue.

-> Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->Content()}

So I guess I’m looking to change the template to something like:

—BEGIN—
if owner eq Nobody {
To: group-list@company.com
Subject: {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue.

} else {
To: owner->email
Subject: Your Ticket in {$Ticket->QueueObj->Name()} Queue: {$Ticket->Subject()}

Ticket #{$Ticket->id} has been added to the {$Ticket->QueueObj->Name()} queue and assigned to you.

}

→ Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->Content()}
—BEGIN—

What do you think?

Thanks!
js.

Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net
Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net

Hi Jean-Sebastien,

I’d use two scrips in your case.
1)
Decription: Notify Group On New Unowned Ticket
Condition: UserDefined
Action: NotifyGroup using this Extension:

Template: Notify Group On New Ticket

Custom Condition:
unless( $self->TransactionObj->Type eq “Status”
&& $self->TransactionObj->Field eq “new” )
{
return 0;
}
return 1;

Description: Notify Owner On New Ticket
Condition: On Create
Action: Notify Owner
Template: Notify Owner

Keep in mind that no mails are sent if owner is Nobody so scrip #2 will
only work if there’s really an owner. But you may want to extend the
first condition to look if the owner is Nobody. Otherwise the group will
be informed in each case. But I’m too lazy to look for that code now
too. Check the wiki at HomePage - Request Tracker Wiki and
the list at Carbon60: Cloud Consulting - Services and Solutions too, they will
become your best friends while using RT. :wink:

I hope that helps a little bit.

Best,
Ben

Jean-Sebastien Morisset schrieb:

Benjamin,

That was great - thanks!

Here’s what I ended up using:

Condition: User Defined
Action: Send Email
Template: Added to Queue Email
Stage: TransactionCreate
Custom condition: return ( $self->TransactionObj->Type eq “Create” &&
$self->TicketObj->Owner == $RT::Nobody->Id );

I also did the same thing with my ‘Auto Reply’ scrip, figuring that if
you choose an Owner for your new ticket, then you’re using the interface
and don’t need the ‘Auto Reply’ e-mail. :slight_smile:

Thanks!
js.On Mon, Mar 03, 2008 at 05:13:43PM +0100, Benjamin Weser wrote:

Hi Jean-Sebastien,

I’d use two scrips in your case.
1)
Decription: Notify Group On New Unowned Ticket
Condition: UserDefined
Action: NotifyGroup using this Extension:
RT-Action-NotifyGroup-0.02 - RT Action-NotifyGroup Extension - metacpan.org
Template: Notify Group On New Ticket

Custom Condition:
unless( $self->TransactionObj->Type eq “Status”
&& $self->TransactionObj->Field eq “new” )
{
return 0;
}
return 1;

Description: Notify Owner On New Ticket
Condition: On Create
Action: Notify Owner
Template: Notify Owner

Keep in mind that no mails are sent if owner is Nobody so scrip #2 will
only work if there’s really an owner. But you may want to extend the
first condition to look if the owner is Nobody. Otherwise the group will
be informed in each case. But I’m too lazy to look for that code now
too. Check the wiki at HomePage - Request Tracker Wiki and
the list at Carbon60: Managed Cloud Services too, they will
become your best friends while using RT. :wink:
[snip!]

Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net