Hello Kenn,<br><br>thanks for your scrip, I'm using the rt-crontool for ticket escalation and could not find out how to use custom actions with rt-crontool, maybe you have a hint for me.<br><br>Thanks, Ivan<br><br><div class="gmail_quote">
2010/5/3 Kenneth Crocker <span dir="ltr"><<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Givano,<br><br>I have a scrip that sets the owner based on the value in a Custom Field. Look at it and modify it to meet your needs:<br><br># Custom Action preparation code<br><br>my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
<br>#<br># set new ticket owner id value<br>#<br>#    42 -  Bob<br>#   148 - Carol<br>#  5125 - Ted<br>#  9324 - Alice<br>#<br><br>my %orgs = qw(<br>           Budget         148<br>           Controller      5125<br>           Facilities      42<br>

           Field-OPS    5125<br>           Property       9324<br>           SPO            148<br>           Travel           5125<br>           Other           42<br>          );<br><br>my $cf = new RT::CustomField($RT::SystemUser);<br>

$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "CFO-Org");<br><br># check for valid CF-Org value first,<br># then set new Ticket Owner ID<br><br>if ($cf->id)<br>    {<br>     my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org');  <br>

     my $ownerid = $orgs{$cfvalue};<br>     $ticket->SetOwner($ownerid);<br>    }<br><br>return 1;<br><br>You could easily replace the owner Ids with your email address and instead of setting the ownerid, set the "To" address or whatever.<br>

<br>Anyway, hope this helps. It sure works for us.<br><br>Kenn<br>LBNL<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, May 3, 2010 at 8:49 AM, Givano <span dir="ltr"><<a href="mailto:givano@gmail.com" target="_blank">givano@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">Hi,<br><br>I'm trying to send an email from template, initiated by rt-crontool as described in wiki, the only trick is that dependent on custom field it should be sent to other persons group. Here my template, somehow it always send to user1 and user 2.<br>


<br>########################<br>Subject: new ticket, 30 minutes unowned!<br>RT-Send-Cc: { my $values = $Ticket->CustomFieldValues('CIT_Category');<br>  my $OUTPUT;<br>  my $CFValue;<br>  while ( my $value = $values->Next ) {<br>


    $CFValue = $value->Content;<br>    if ($CFValue == 'IT Facilites') { $OUTPUT = '<a href="mailto:user1@dom.com" target="_blank">user1@dom.com</a>, <a href="mailto:user2@dom.com" target="_blank">user2@dom.com</a>' }<br>

    elsif ($CFValue == 'Linux/Network') { $OUTPUT =  '<a href="mailto:user3@dom.com" target="_blank">user3@dom.com</a>, <a href="mailto:user4@dom.com" target="_blank">user4@dom.com</a>' }<br>
    elsif ($CFValue == 'Phone') { $OUTPUT =  '<a href="mailto:user5@dom.com" target="_blank">user5@dom.com</a>, <a href="mailto:user6@dom.com" target="_blank">user6@dom.com</a>' }<br>    elsif ($CFValue == 'Windows') { $OUTPUT =  '<a href="mailto:user7@dom.com" target="_blank">user7@dom.com</a>, <a href="mailto:user8@dom.com" target="_blank">user8@dom.com</a>' }<br>


  }<br>  $OUTPUT;<br>}<br><br>The ticket {$Ticket->id} stayed unowned for 30 minutes.  <br><br>Please do a categorisation, assign optionally an owner!<br>######################################<br><br>Any idea what I'm doing wrong, maybe there is some, more elegant method to do a custom field based escalation, here is how I'am starting the rt-crontool:<br>


<br>rt-crontool --search RT::Search::FromSQL --search-arg "id = 23331" --action RT::Action::RecordComment --template 'UnownedNotifyWatcherLevel1'<br><br>Thanks in advance,<br><br>Ivan Samarin<br><br>
<br><br></div></div>
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><br></blockquote></div><br>
</blockquote></div><br>