Thanks Ken for the script. I've altered Ken's script to this:
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
if  ($trans->Type eq 'CustomField')
    {my $cf = new RT::CustomField($RT::SystemUser);
        $cf->LoadByName(Queue => $ticket->QueueObj->id,
         Name => 'Urgency');
     return 0 unless $cf->id;
     if  ($trans->Field == $cf->id ic $trans->NewValue eq 'URGENT')
          {
          $RT::Logger->debug('.');
          $RT::Logger->debug('It is an URGENT ticket so send the owner a 
message.');
          $RT::Logger->debug('.');
          return 1;
          }
     else
        {
        $RT::Logger->debug('.');
        $RT::Logger->debug('Fell through the check and into the else.');
        $RT::Logger->debug('.');
        }
    }

return 0;
===================================================
The debug output shows it is doing what's expected but I am not receiving an 
email. The debug output indicates that no recipients were found. So... How do I 
correct that?
I want the owner of the ticket to be notified by email if a ticket is created 
with an URGENT status or if the status changes to URGENT.

Actual debug output:
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc; recipients are  
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165] URGENT: URGENT
From: "Kevin W. Gagel via RT" r...@xxxxxx.bc.ca
Reply-To: r...@xxxxxx.bc.ca
Message-ID: <rt-3.8.2-19683-1245707462-1931.165-1...@cnc IT Services>
Precedence: bulk
X-RT-Loop-Prevention: CNC's Ticket System
RT-Ticket: CNC's Ticket System #165
Managed-by: RT 3.8.2 (http://www.bestpractical.com/rt/)
RT-Originator: ga...@xxxxxx.bc.ca
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from Bcc: line 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: No recipients found for deferred delivery 
on transaction #2236 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:702)


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker <kfcroc...@lbl.gov>
To: Kevin Gagel <ga...@cnc.bc.ca>
Cc: RT Users <RT-Users@lists.bestpractical.com>
Date: 16/06/2009 3:56 PM


Kevin,


Here's one we use for when the development step of a ticket (CF "Work-State") 
is changed to "Review Approved":

# condition execution on CF Review Process

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq 'CustomField')
    {my $cf = new RT::CustomField($RT::SystemUser);
        $cf->LoadByName(Queue => $ticket->QueueObj->id,
         Name => "Work-State");
     return 0 unless $cf->id;
     if  ($trans->Field == $cf->id ic
          $trans->NewValue eq "Review Complete-Approved")
          {
           return 1;
          }
    }

return 0;

Just plug in your CF name and value you want and you're set. Hope this helps.

Kenn
LBNL

On 6/16/2009 2:53 PM, Kevin Gagel wrote:    My users don't want to use 
priorities so they've had me create 4 levelsfor urgency. They only want to be 
notified by email on an item that hasthe highest urgency level set. So I want 
to setup a custom conditionthat tests for that level and then sends an email to 
the user if thatspecific level is set.

So, I have a custom field of "Urgency" which can have a value of URGENT, High, 
Medium, Low, or Project.
I have the template made already for the email to be sent out and thescrip 
configured for it. I just don't know how to write the customcondition to put 
into the scrip. How do I write the condition to test for "URGENT" and indicate 
the action to send the email?

All the references I'm finding in the RT Essentials have me a bit confused, am 
I supposed to right a new module to make this scrip or can I just add the perl 
code to the condition (not that I know what code I have to enter just yet).

Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel




_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help:http://wiki.bestpractical.com
Commercial support:sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy athttp://rtbook.bestpractical.com
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


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

Reply via email to