<html>
<body>
I think you could make these changes in the scrip:<br><br>
{ ### True if e-mail contains 'ok' - sets owner, resolves ticket<br>
    my $Transaction = $self->TransactionObj;<br>
    my $CreatorMail =
$Transaction->CreatorObj->EmailAddress();<br>
    my $val = $Transaction->Type eq 'Correspond'<br>
           &&
$CreatorIdMail =~ /\@foo\.com/i<br>
           &&
$Transaction->Content  =~ /\bok\s/i;<br>
    return $val;<br>
}<br><br>
<br>
At 01:37 PM 11/27/2007, Mark Fuller wrote:<br>
<blockquote type=cite class=cite cite="">
<font face="arial" size=2 color="#0000FF">So to be a pain but ran into an
issue after setting up and testing. <br>
</font> <br>
>Custom condition:<br>
>{ ### True if e-mail contains 'ok' - sets owner, resolves ticket<br>
>    my $Transaction = $self->TransactionObj;<br>
>    my $CreatorId =
$Transaction->CreatorObj->Id;<br>
>    my $Queue = $self->TicketObj->QueueObj;<br>
>    my $val = $Transaction->Type eq
'Correspond'<br>
>          
&& $Queue->IsAdminCc($CreatorId)<br>
>          
&& $Transaction->Content  =~ /\bok\s/i;<br>
>    return $val;<br>
>}<br>
 <br>
<font face="arial" size=2 color="#0000FF">I have a group of level 1 techs
that do not have a unique logon since it is an ever changing group of
folks. is there a way that I can do this based on the domain name of
there email and set it to a specified user?<br>
</font> <br>
 <br>
<font face="arial" size=2 color="#0000FF">something like<br>
</font> <br>
<a href="mailto:%@foo.com">%@foo.com</a> = creatorid 21<br>
 <br>
<font face="arial" size=2 color="#0000FF">Also I found a way at least for
my setup to get it to not send emails to requestors. We send the message
to the comment address and I changed it to be<br>
</font> <br>
 <br>
Custom condition:<br>
{ ### True if e-mail contains 'ok' - sets owner, resolves ticket<br>
    my $Transaction = $self->TransactionObj;<br>
    my $CreatorId =
$Transaction->CreatorObj->Id;<br>
    my $Queue = $self->TicketObj->QueueObj;<br>
    my $val = $Transaction->Type eq 'Comment'<br>
           &&
$Queue->IsAdminCc($CreatorId)<br>
           &&
$Transaction->Content  =~ /\bok\s/i;<br>
    return $val;<br>
}<br>
 <br>
<font face="arial" size=2 color="#0000FF">and that works perfect for my
level 2 and 3 support groups<br>
</font> <br>
 <br><br>
<i>Mark Fuller<?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><br>
</i><br>
<i>BandTel Engineering<br>
</i><br>
<i>603-528-6538 Option 2<br>
</i><br>
<i>603-528-6937 FAX<br>
</i><br>
 <br>

<dl>
<dd><font face="tahoma" size=2>-----Original Message-----<br>

<dd>From:</b> Gene LeDuc
[<a href="mailto:gleduc@mail.sdsu.edu" eudora="autourl">
mailto:gleduc@mail.sdsu.edu</a>] <br>

<dd>Sent:</b> Tuesday, November 27, 2007 3:50 PM<br>

<dd>To:</b> Mark Fuller; Asrai khn<br>

<dd>Cc:</b> rt-users@lists.bestpractical.com<br>

<dd>Subject:</b> RE: [rt-users] take and resolve actions via
email<br><br>
</font>
<dd>Hi Mark (and Askar),<br><br>

<dd>After reviewing my previous advice, I've changed my mind.  This
should be a cleaner solution.<br><br>

<dd>1.  Don't mess with your templates.<br><br>

<dd>2.  I don't know whether _Set works with custom fields, so I'd
use the following to set your CF in the scrip I sent you.  The scrip
should probably be a queue scrip, not global, unless you want to do this
for all your queues:<br>

<dd>set_custom('noemail', "yes", 0);<br>

<dd>### Sets custom field value<br>

<dd>### Usage: set_custom($field_name, $field_value,
$record_transaction)<br>

<dd>sub set_custom {<br>

<dd>  my ($CFName, $CFValue, $record) = @_;<br>

<dd>  $record = $record ? 1 : 0;<br>

<dd>  my $cf = RT::CustomField->new($RT::SystemUser);<br>

<dd>  my ($id,$msg) = $cf->LoadByName(Name=>$CFName,);<br>

<dd>  if (!$id) {<br>

<dd>    $RT::Logger->debug("Error loading custom
field '$CFName'");<br>

<dd>    return undef;<br>

<dd>  }<br>

<dd>  ($id, $msg) = $Ticket->AddCustomFieldValue<br>

<dd>     (Field=>$cf, Value=>$CFValue,
RecordTransaction=>$record);<br>

<dd>}<br><br>

<dd>3.  Modify your Global Scrips #6 ("<font size=2>On
Correspond Notify Requestors and Ccs with template
Correspondence</font>") and #7 ("<font size=2>On Correspond
Notify Other Recipients with template Correspondence</font>")
and<br>

<dd>  a) change the Condition to User Defined; and<br>

<dd>  b) put the following code in the Custom condition area of both
scrips:<br>

<dd>{ ### True when transaction is incoming email and CF 'noemail' is not
set<br>

<dd>  my $Transaction = $self->TransactionObj;<br>

<dd>  my $Ticket = $self->TicketObj;<br>

<dd>  my $val = $Transaction->Type eq "Correspond"<br>

<dd>      && !
get_custom("noemail");<br>

<dd>  return $val;<br><br>

<dd>  ### Returns custom field value<br>

<dd>  ### get_custom($field_name)<br>

<dd>  sub get_custom {<br>

<dd>    my $target_name = $_[0];<br>

<dd>    my $val =
$Ticket->FirstCustomFieldValue($target_name);<br>

<dd>    return $val if defined $val;<br>

<dd>    return undef;<br>

<dd>  }<br>

<dd>}<br><br>

<dd>So you should have 2 scenarios now with incoming email.<br>

<dd>1.  Email is from AdminCc and contains trigger word(s) in first
line.<br>

<dd>  a) Your new scrip fires and sets the CF 'noemail' to 'yes',
Owner to email sender, Status to resolved<br>

<dd>  b) Global scrip #5 ("<font size=2>On Correspond Notify
AdminCcs with template Admin Correspondence</font>") fires and sends
mail to AdminCcs<br>

<dd>  c) Global scrips #6 and #7 do not fire because CF 'noemail' is
set, so no mail is sent to anyone else<br><br>

<dd>2.  Email is not from AdminCc or does not contain trigger
word(s) in first line:<br>

<dd>  a) Your new scrip does not fire because both conditions are
not met, so CF 'noemail' is not set<br>

<dd>  b) Global scrip #5 fires<br>

<dd>  c) Global scrips #6 and #7 fire because CF 'noemail' either
doesn't exist or is not set<br><br>

<dd>Have fun!<br><br>

<dd>Regards,<br>

<dd>Gene<br><br>

<dd>At 10:06 AM 11/27/2007, Mark Fuller wrote:<br>
<blockquote type=cite class=cite cite="">
<dd>Ok I am very new to this so I added<br><br>
<br>

<dd> $Ticket->_Set(Field => 'noemail', Value => 'yes',
RecordTransaction => 0);<br><br>

<dd>Now how do I tell the correspondence to look for that. And also if I
change<br>

<dd>the main script like that and I have the custom field set how do I
get the<br>

<dd>filed to be blank or no so that all future correspondence will work.
<br><br>

<dd>Again I am new to RT but we love it and are expanding it's use. I
thought<br>

<dd>about command by email but the CTO is concerned as am I with security
and<br>

<dd>this seems the safer way. Also we do want to comment via
email<br><br>

<dd>Mark Fuller<br><br>

<dd>BandTel Engineering<br><br>

<dd>603-528-6538 Option 2<br><br>

<dd>603-528-6937 FAX<br><br>

<dd>-----Original Message-----<br>

<dd>From: Gene LeDuc [
<a href="mailto:gleduc@mail.sdsu.edu" eudora="autourl">
mailto:gleduc@mail.sdsu.edu</a>] <br>

<dd>Sent: Monday, November 26, 2007 4:27 PM<br>

<dd>To: Mark Fuller<br>

<dd>Cc: rt-users@lists.bestpractical.com<br>

<dd>Subject: RE: [rt-users] take and resolve actions via email<br><br>

<dd>Hi Mark,<br><br>

<dd>I'm not sure how you could change a correspondence transaction to a
<br>

<dd>comment.  However...<br><br>

<dd>If I wanted to just change the way that email is sent (only AdminCcs
<br>

<dd>getting an email), I'd add a custom field to the queue called <br>

<dd>"NoCorrespond" and then modify the Correspondence template
used for the "On <br>

<dd>Correspond" scrip to include a check at the beginning to see if
there is a <br>

<dd>"NoCorrespond" field and whether it has anything in
it.  If so, exit the <br>

<dd>template and don't send the email, otherwise proceed as usual. 
Then I'd <br>

<dd>have the scrip I gave you put something into the
"NoCorrespond" custom <br>

<dd>field at the same time that it sets the owner and status.  It's
kind of <br>

<dd>clunky and there are probably more elegant solutions, but I think it
would <br>

<dd>work.  You might also want to make another scrip to send the
mail to the <br>

<dd>AdminCc when the "NoCorrespond" field gets something
assigned to it (by <br>

<dd>your other scrip), something like (I haven't tried this scrip, so it
may <br>

<dd>need work):<br><br>

<dd>Condition: User Defined<br>

<dd>Action: Notify AdminCcs as Comment<br>

<dd>Template: Global template: Admin Comment<br>

<dd>Custom condtion:<br>

<dd>{ ### True on state change to "NoCorrespond"<br>

<dd>   my $Transaction = $self->TransactionObj;<br>

<dd>   my $val = $Transaction->Type eq
"CustomField"<br>

<dd>       &&
$Transaction->Field eq "NoCorrespond"<br>

<dd>       ;<br>

<dd>   return $val;<br>

<dd>}<br><br>

<dd>Good luck!<br>

<dd>Gene<br><br>

<dd>At 12:00 PM 11/26/2007, Mark Fuller wrote:<br>

<dd>>Thanks Gene it works great but.. Is there a way to make it a
comment so <br>

<dd>>only admin staff gets it<br>

<dd>><br>

<dd>>Mark Fuller<br>

<dd>><br>

<dd>>-----Original Message-----<br>

<dd>>From: Gene LeDuc [
<a href="mailto:gleduc@mail.sdsu.edu" eudora="autourl">
mailto:gleduc@mail.sdsu.edu</a>]<br>

<dd>>Sent: Monday, November 26, 2007 12:26 PM<br>

<dd>>To: Mark Fuller<br>

<dd>>Cc: rt-users@lists.bestpractical.com<br>

<dd>>Subject: RE: [rt-users] take and resolve actions via email<br>

<dd>><br>

<dd>><br>

<dd>>Hi Mark,<br>

<dd>><br>

<dd>>Here's the scrip we use to resolve tickets via e-mail.<br>

<dd>><br>

<dd>>In order to resolve a ticket this way, the e-mail must be from an
<br>

<dd>>AdminCc for that queue and it must contain the word
"Ok" on the first <br>

<dd>>line.<br>

<dd>><br>

<dd>>Description: Resolved by e-mail<br>

<dd>>Condition: User Defined<br>

<dd>>Action: User Defined<br>

<dd>>Template: Global template: Blank<br>

<dd>>Stage: TransactionCreate<br>

<dd>><br>

<dd>>Custom condition:<br>

<dd>>{ ### True if e-mail contains 'ok' - sets owner, resolves
ticket<br>

<dd>>    my $Transaction =
$self->TransactionObj;<br>

<dd>>    my $CreatorId =
$Transaction->CreatorObj->Id;<br>

<dd>>    my $Queue =
$self->TicketObj->QueueObj;<br>

<dd>>    my $val = $Transaction->Type eq
'Correspond'<br>

<dd>>          
&& $Queue->IsAdminCc($CreatorId)<br>

<dd>>          
&& $Transaction->Content  =~ /\bok\s/i;<br>

<dd>>    return $val;<br>

<dd>>}<br>

<dd>><br>

<dd>>Custom action prep code:<br>

<dd>>return 1;<br>

<dd>><br>

<dd>>Custom action cleanup code:<br>

<dd>>### Set Set owner to e-mail sender, status to 'resolved'<br>

<dd>>my $Ticket = $self->TicketObj;<br>

<dd>>my $Transaction = $self->TransactionObj;<br>

<dd>>my $CreatorId = $Transaction->CreatorObj->Id; <br>

<dd>>$Ticket->_Set(Field=>'Owner', Value=>$CreatorId,
RecordTransaction=>0); <br>

<dd>>$Ticket->_Set(Field => 'Status', Value => 'resolved',
RecordTransaction <br>

<dd>>=> 0);<br>

<dd>><br>

<dd>>The 2 lines at the end of the cleanup code could also be:<br>

<dd>>     
$Ticket->SetOwner($CreatorId);<br>

<dd>>     
$Ticket->SetStatus('resolved');<br>

<dd>>but I use _Set instead because I don't want to fire off any more
<br>

<dd>>transactions when I resolve tickets this way.<br>

<dd>><br>

<dd>>Regards,<br>

<dd>>Gene</blockquote><br><br>

<dd>-- <br>

<dd>Gene LeDuc, GSEC<br>

<dd>Security Analyst<br>

<dd>San Diego State University <br>
</blockquote>
<x-sigsep><p></x-sigsep>

</dl><br>
-- <br>
Gene LeDuc, GSEC<br>
Security Analyst<br>
San Diego State University</body>
</html>