[rt-users] take and resolve actions via email

Gene LeDuc gleduc at mail.sdsu.edu
Mon Nov 26 16:26:57 EST 2007

Hi Mark,

I'm not sure how you could change a correspondence transaction to a 
comment.  However...

If I wanted to just change the way that email is sent (only AdminCcs 
getting an email), I'd add a custom field to the queue called 
"NoCorrespond" and then modify the Correspondence template used for the "On 
Correspond" scrip to include a check at the beginning to see if there is a 
"NoCorrespond" field and whether it has anything in it.  If so, exit the 
template and don't send the email, otherwise proceed as usual.  Then I'd 
have the scrip I gave you put something into the "NoCorrespond" custom 
field at the same time that it sets the owner and status.  It's kind of 
clunky and there are probably more elegant solutions, but I think it would 
work.  You might also want to make another scrip to send the mail to the 
AdminCc when the "NoCorrespond" field gets something assigned to it (by 
your other scrip), something like (I haven't tried this scrip, so it may 
need work):

Condition: User Defined
Action: Notify AdminCcs as Comment
Template: Global template: Admin Comment
Custom condtion:
{ ### True on state change to "NoCorrespond"
   my $Transaction = $self->TransactionObj;
   my $val = $Transaction->Type eq "CustomField"
       && $Transaction->Field eq "NoCorrespond"
   return $val;

Good luck!

At 12:00 PM 11/26/2007, Mark Fuller wrote:
>Thanks Gene it works great but.. Is there a way to make it a comment so only
>admin staff gets it
>Mark Fuller
>-----Original Message-----
>From: Gene LeDuc [mailto:gleduc at mail.sdsu.edu]
>Sent: Monday, November 26, 2007 12:26 PM
>To: Mark Fuller
>Cc: rt-users at lists.bestpractical.com
>Subject: RE: [rt-users] take and resolve actions via email
>Hi Mark,
>Here's the scrip we use to resolve tickets via e-mail.
>In order to resolve a ticket this way, the e-mail must be from an AdminCc
>for that queue and it must contain the word "Ok" on the first line.
>Description: Resolved by e-mail
>Condition: User Defined
>Action: User Defined
>Template: Global template: Blank
>Stage: TransactionCreate
>Custom condition:
>{ ### True if e-mail contains 'ok' - sets owner, resolves ticket
>    my $Transaction = $self->TransactionObj;
>    my $CreatorId = $Transaction->CreatorObj->Id;
>    my $Queue = $self->TicketObj->QueueObj;
>    my $val = $Transaction->Type eq 'Correspond'
>           && $Queue->IsAdminCc($CreatorId)
>           && $Transaction->Content  =~ /\bok\s/i;
>    return $val;
>Custom action prep code:
>return 1;
>Custom action cleanup code:
>### Set Set owner to e-mail sender, status to 'resolved'
>my $Ticket = $self->TicketObj;
>my $Transaction = $self->TransactionObj;
>my $CreatorId = $Transaction->CreatorObj->Id; $Ticket->_Set(Field=>'Owner',
>Value=>$CreatorId, RecordTransaction=>0); $Ticket->_Set(Field => 'Status',
>Value => 'resolved', RecordTransaction => 0);
>The 2 lines at the end of the cleanup code could also be:
>      $Ticket->SetOwner($CreatorId);
>      $Ticket->SetStatus('resolved');
>but I use _Set instead because I don't want to fire off any more
>transactions when I resolve tickets this way.

Gene LeDuc, GSEC
Security Analyst
San Diego State University 

More information about the rt-users mailing list