<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Kevin,<br>
<br>
You can get the Id thus:<br>
 my $Corresponder =
$self->TransactionObj->CreatorObj->PrincipalId;<br>
and you can check if it is nobody against "$RT::Nobody->Id".<br>
Maybe someone else on the list can help you with the check for
"privileged.<br>
<br>
As for why an Email goes out or not, that depends on:<br>
<ol>
  <li>valid scrip condition & action</li>
  <li>valid UserID as recipient (must be privileged and has rights to
queue sending out Email).<br>
  </li>
</ol>
<br>
Kenn<br>
LBNL<br>
<br>
On 6/22/2009 4:16 PM, Kevin Gagel wrote:
<blockquote cite="mid:4a4010e9.e08.f38.4ae0@cnc.bc.ca" type="cite">
  <style>
 .sw_message P{margin:0px;padding:0px;}
 .sw_message {FONT-SIZE: 12pt;FONT-FAMILY:Tahoma,Arial,Helvetica,sans-serif;background:white;}
  </style>Yeah, I hadn't considered that. But in that case then it
shouldn't try to send the email. So it'll need a check for the owner
and if the owner is not nobody then send the message. Still, I don't
know how to do either of those checks, for the owner and then to ensure
it sends an email.<br>
  <br>
Any pointers?<br>
  <br>
  <br>
Kevin W. Gagel<br>
Network Administrator<br>
Local 5448<br>
My blog:<br>
<a class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/blogs/gagel">http://mail.cnc.bc.ca/blogs/gagel</a><br>
My shared files:<br>
<a class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/users/gagel">http://mail.cnc.bc.ca/users/gagel</a><br>
  <br>
  <br>
--- Original message --- <br>
Subject: Re: [rt-users] Question on custom scrip condition <br>
From: Ken Crocker <a class="moz-txt-link-rfc2396E" href="mailto:kfcrocker@lbl.gov"><kfcrocker@lbl.gov></a> <br>
To: Kevin Gagel <a class="moz-txt-link-rfc2396E" href="mailto:gagel@cnc.bc.ca"><gagel@cnc.bc.ca></a> <br>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:RT-Users@lists.bestpractical.com"><RT-Users@lists.bestpractical.com></a> <br>
Date: 22/06/2009 3:24 PM<br>
  <br>
  <div>Kevin,<br>
  <br>
What if the ticket is created WITHOUT an owner?<br>
  <br>
Kenn<br>
LBNL<br>
  <br>
On 6/22/2009 2:57 PM, Kevin Gagel wrote:
  <blockquote cite="mid:4a3ffe4b.e08.f00.270@cnc.bc.ca" type="cite">
    <style> .sw_message P{margin:0px;padding:0px;} .sw_message {FONT-SIZE: 12pt;FONT-FAMILY:Tahoma,Arial,Helvetica,sans-serif;background:white;}  </style>Thanks
Ken for the script. I've altered Ken's script to this:<br>
my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
if  ($trans->Type eq 'CustomField')<br>
    {my $cf = new RT::CustomField($RT::SystemUser);<br>
        $cf->LoadByName(Queue => $ticket->QueueObj->id,<br>
         Name => 'Urgency');<br>
     return 0 unless $cf->id; <br>
     if  ($trans->Field == $cf->id && $trans->NewValue
eq 'URGENT')<br>
          {<br>
          $RT::Logger->debug('.');<br>
          $RT::Logger->debug('It is an URGENT ticket so send the
owner a message.');<br>
          $RT::Logger->debug('.');<br>
          return 1;<br>
          }<br>
     else<br>
        {<br>
        $RT::Logger->debug('.');<br>
        $RT::Logger->debug('Fell through the check and into the
else.');<br>
        $RT::Logger->debug('.');<br>
        }<br>
    }<br>
    <br>
return 0;<br>
===================================================<br>
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?<br>
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.<br>
    <br>
Actual debug output:<br>
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)<br>
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc;
recipients are  (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)<br>
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165]
URGENT: URGENT <br>
From: "Kevin W. Gagel via RT" rt\@XXXXXX.bc.ca<br>
Reply-To: rt\@XXXXXX.bc.ca<br>
Message-ID: <rt-3.8.2-19683-1245707462-1931.165-12-0@CNC IT
Services><br>
Precedence: bulk<br>
X-RT-Loop-Prevention: CNC's Ticket System<br>
RT-Ticket: CNC's Ticket System #165<br>
Managed-by: RT 3.8.2 (<a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://www.bestpractical.com/rt/">http://www.bestpractical.com/rt/</a>)<br>
RT-Originator: <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-abbreviated" href="mailto:gagel@XXXXXX.bc.ca">gagel@XXXXXX.bc.ca</a><br>
MIME-Version: 1.0<br>
Content-Transfer-Encoding: 8bit<br>
Content-Type: text/plain; charset="utf-8"<br>
X-RT-Original-Encoding: utf-8
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)<br>
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from
Bcc: line (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)<br>
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)<br>
[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)<br>
    <br>
    <br>
Kevin W. Gagel<br>
Network Administrator<br>
Local 5448<br>
My blog:<br>
    <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/blogs/gagel">http://mail.cnc.bc.ca/blogs/gagel</a><br>
My shared files:<br>
    <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/users/gagel">http://mail.cnc.bc.ca/users/gagel</a><br>
    <br>
    <br>
--- Original message --- <br>
Subject: Re: [rt-users] Question on custom scrip condition <br>
From: Ken Crocker <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-rfc2396E" href="mailto:kfcrocker@lbl.gov"><kfcrocker@lbl.gov></a>
    <br>
To: Kevin Gagel <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-rfc2396E" href="mailto:gagel@cnc.bc.ca"><gagel@cnc.bc.ca></a>
    <br>
Cc: RT Users <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-rfc2396E"
 href="mailto:RT-Users@lists.bestpractical.com"><RT-Users@lists.bestpractical.com></a>
    <br>
Date: 16/06/2009 3:56 PM<br>
    <br>
    <div>Kevin,<br>
    <br>
    <br>
Here's one we use for when the development step of a ticket (CF
"Work-State") is changed to "Review Approved":<br>
    <br>
# condition execution on CF Review Process<br>
    <br>
my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
    <br>
if  ($trans->Type eq 'CustomField')<br>
    {my $cf = new RT::CustomField($RT::SystemUser);<br>
        $cf->LoadByName(Queue => $ticket->QueueObj->id,<br>
         Name => "Work-State");<br>
     return 0 unless $cf->id;  <br>
     if  ($trans->Field == $cf->id &&<br>
          $trans->NewValue eq "Review Complete-Approved")<br>
          {<br>
           return 1;<br>
          }<br>
    }<br>
    <br>
return 0;<br>
    <br>
Just plug in your CF name and value you want and you're set. Hope this
helps.<br>
    <br>
Kenn<br>
LBNL<br>
    <br>
On 6/16/2009 2:53 PM, Kevin Gagel wrote:
    <blockquote cite="mid:4a381448.e44.300.10cb@cnc.bc.ca" type="cite">
      <style> .sw_message P{margin:0px;padding:0px;} .sw_message {FONT-SIZE: 12pt;FONT-FAMILY:Tahoma,Arial,Helvetica,sans-serif;background:white;}  </style>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.<br>
      <br>
So, I have a custom field of "Urgency" which can have a value of
URGENT, High, Medium, Low, or Project.<br>
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?<br>
      <br>
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).<br>
      <br>
Kevin W. Gagel<br>
Network Administrator<br>
Local 5448<br>
My blog:<br>
      <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/blogs/gagel">http://mail.cnc.bc.ca/blogs/gagel</a><br>
My shared files:<br>
      <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://mail.cnc.bc.ca/users/gagel">http://mail.cnc.bc.ca/users/gagel</a><br>
      <br>
      <br>
      <pre wrap=""> 
<hr size="4" width="90%"> 
_______________________________________________ 
<a moz-do-not-send="true" target="_blank" class="moz-txt-link-freetext"
 href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a> 
 
Community help: <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a> 
Commercial support: <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a> 
 
 
Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
    </blockquote>
    </div>
    <pre wrap=""> 
<hr size="4" width="90%"> 
_______________________________________________ 
<a moz-do-not-send="true" target="_blank" class="moz-txt-link-freetext"
 href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a> 
 
Community help: <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a> 
Commercial support: <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a> 
 
 
Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at <a moz-do-not-send="true" target="_blank"
 class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
  </blockquote>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>

Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
</blockquote>
</body>
</html>