Paul,<br><br>I may be wrong, but I think the reason is that when a ticket is being created, I don't believe that the "Ticket Custom Field: is available at the time of "Custom Condition". I think you will have to add the code that checks on the value of the Ticket Custom Field in one of the Custom Action sections along with your code to add the Cc's. That also may be why the example has an "or" in that code. Hope this helps.<br>
<br>Kenn<br>LBNL<br><br><div class="gmail_quote">On Thu, Jun 10, 2010 at 1:53 PM, Dougherty Paul <span dir="ltr"><<a href="mailto:paul_dougherty@prn.com">paul_dougherty@prn.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">









<div link="blue" vlink="purple" lang="EN-US">

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Hi
Keith,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">First
off, thanks for your help.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">This
is what I am trying to implement…<a href="http://wiki.bestpractical.com/view/AddWatcherPerTicket" target="_blank">http://wiki.bestpractical.com/view/AddWatcherPerTicket</a></span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">I
want this to fire when tickets are created and when the custom field of Urgency
(already created and gets poplutated) is critical.</span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">This
is from the wiki…</span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">return
undef unless ( ($self->TransactionObj->Type eq "Create")
||  </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">                    
( $self->TicketObj->FirstCustomFieldValue('Urgency') eq
"High"));   </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">return
1;</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">So
what I am trying to do is change the or statement to an and with && and
change the High to Critical….but somehow this fails. I have tried every
combination I can think of….</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Interestingly,
I can get the first part (create) to fire correctly when it is by itself. I cannot
get the Urgency part to ever evaluate as true. </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Cheers,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Paul</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0in 0in;">

<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
<a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>
[mailto:<a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>] <b>On Behalf Of </b>Kenneth
Crocker<br>
<b>Sent:</b> Thursday, June 10, 2010 1:40 PM<div><div></div><div class="h5"><br>
<b>To:</b> <a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a><br>
<b>Subject:</b> Re: [rt-users] Scrip help please.</div></div></span></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom: 12pt;">Paul,<br>
<br>
Perhaps I misunderstood. Are you wanting to meet these conditions at the same
time (ie. a create with a CF) or are these to be two separate conditions
exclusive of each other?<br>
<br>
Kenn<br>
LBNL</p>

<div>

<p class="MsoNormal">On Wed, Jun 9, 2010 at 3:37 PM, Dougherty Paul <<a href="mailto:paul_dougherty@prn.com" target="_blank">paul_dougherty@prn.com</a>> wrote:</p>

<div>

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Hi Keith,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">These did not help…I have gotten closer to the
error, however.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">It seems rather stupid, all I am trying to do is to get
the condition to ring true in my scrip.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">This is what I have.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">($self->TicketObj->FirstCustomFieldValue('Urgency')
eq "Critical");</span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">There are no errors
generated by this scrip…but it doesn’t add the watchers…(this
part works when the above condition is met). For example, if I simply use
this…</span>($self->TransactionObj->Type eq "Create"); in
the condition, the scrip adds the watchers. </p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">Watcher add code:</span></p>

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">$self->TicketObj->AddWatcher( Type =>
"Cc", </span></p>

</div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">                             
Email =>"paul_dougherty\@<a href="http://prn.com" target="_blank">prn.com</a>");
</span></p>

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">push( @{$self->{'To'}}, </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">     
$self->TicketObj->Requestors->MemberEmailAddresses, </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">     
$self->TicketObj->QueueObj->Cc->MemberEmailAddresses ); </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">return 1;</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

</div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Any ideas?</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Thanks,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><br>
Paul</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<div style="border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-color: -moz-use-text-color;">

<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
Kenneth Crocker [mailto:<a href="mailto:kfcrocker@lbl.gov" target="_blank">kfcrocker@lbl.gov</a>]
<br>
<b>Sent:</b> Thursday, June 03, 2010 9:00 AM<br>
<b>To:</b> Dougherty Paul</span></p>

<div>

<div>

<p class="MsoNormal"><span style="font-size: 10pt;"><br>
<b>Subject:</b> Re: [rt-users] Scrip help please.</span></p>

</div>

</div>

</div>

<div>

<div>

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom: 12pt;">Paul,<br>
<br>
I have attached two txt files that have the code in them. These files have
flower box comments and such that I always use to maintain my code. have fun
with them.<br>
<br>
Kenn<br>
LBNL</p>

<div>

<p class="MsoNormal">On
Thu, Jun 3, 2010 at 8:27 AM, Dougherty Paul <<a href="mailto:paul_dougherty@prn.com" target="_blank">paul_dougherty@prn.com</a>>
wrote:</p>

<div>

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Hi Ken,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Sure, I might be able to use those.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Thanks,</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Paul</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<div style="border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-color: -moz-use-text-color;">

<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>
[mailto:<a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>] <b>On Behalf Of </b>Kenneth
Crocker<br>
<b>Sent:</b> Wednesday, June 02, 2010 5:07 PM<br>
<b>To:</b> <a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a><br>
<b>Subject:</b> Re: [rt-users] Scrip help please.</span></p>

</div>

<div>

<div>

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom: 12pt;">Paul,<br>
<br>
I have some code that adds a CC to an individual ticket on a Queue basis. So,
if you want this for just certain types of tickets, maybe you could modify it
for those conditions and put it in the Queues relevant to that need. OH, I also
have some code that add's <i>additional</i> Cc's on "Correspondence"
with those tickets as well. Is that something you might be interested in using?<br>
<br>
Kenn<br>
LBNL</p>

<div>

<p class="MsoNormal">On
Wed, Jun 2, 2010 at 2:50 PM, Dougherty Paul <<a href="mailto:paul_dougherty@prn.com" target="_blank">paul_dougherty@prn.com</a>>
wrote:</p>

<div>

<div>

<p class="MsoNormal">Hi,</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I
am sure this is an id10t error, but I am trying to write a scrip that sends an
adds a “CC” to a new ticket whose urgency is Critical (or
critical). So far, the closest I have gotten is to have the system add the
“CC”’s for every new ticket.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Here
is the custom condition that is giving me the fits. The current error I am
receiving involves a syntax error…thing is, no matter what I try, I
cannot get this thing to work. Every other part of this process works (ie, when
the cc’s are added, the email is sent. The custom action does indeed add
the cc’s).</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I
just need to meet three conditions. One is on create, the other is Urgency
(custom field) Critical or Urgency critical.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Thanks,</p>

<p class="MsoNormal"><br>
Paul</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Custom
condition:</p>

<p class="MsoNormal">if
( ($self->TransactionObj->Type eq "Create") &&</p>

<p class="MsoNormal">                   
( ( $self->TicketObj->FirstCustomFieldValue('Urgency') eq
"Critical") || (
$self->TicketObj->FirstCustomFieldValue('Urgency') eq "critical")))</p>

<p class="MsoNormal">return
1;</p>

<p class="MsoNormal">else
</p>

<p class="MsoNormal">return
0;</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Custom
action: (runs fine):</p>

<p class="MsoNormal">$self->TicketObj->AddWatcher(
Type => "Cc", </p>

<p class="MsoNormal">                             
Email =>"xxx\@<a href="http://prn.com" target="_blank">prn.com</a>");
</p>

<p class="MsoNormal">$self->TicketObj->AddWatcher(
Type => "Cc", </p>

<p class="MsoNormal">                             
Email =>"xxx\@<a href="http://prn.com" target="_blank">prn.com</a>");
</p>

<p class="MsoNormal">push(
@{$self->{'To'}}, </p>

<p class="MsoNormal">     
$self->TicketObj->Requestors->MemberEmailAddresses, </p>

<p class="MsoNormal">     
$self->TicketObj->QueueObj->Cc->MemberEmailAddresses ); </p>

<p class="MsoNormal">return
1;</p>

</div>

</div>

<p class="MsoNormal"><br>
<br>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<br>
Buy a copy at <a href="http://rtbook.bestpractical.com" target="_blank">http://rtbook.bestpractical.com</a></p>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal"> </p>

</div></div></div>

</div>


</blockquote></div><br>