Hi Stephen & Eric & all.

At Monday 6/12/2006 11:06 PM, Luke Vanderfluit wrote:

Hi.

I need to find out which tickets have been created by emails sent in to RT. I'm thiking maybe I can add an attribute value with rt-mailgate, haven't checked the API yet.
Anyone know of a way to do this?

Thanks.
Kind regards.


We have a condition that goes in a scrip to determine this. The code assumes that if the first attachment on a create transaction has a 'Received' header, it's an email create. The code (from the condition) is something like this:

    my $msgattr = $self->TransactionObj->Message->First;
    if ( $msgattr and $msgattr->GetHeader('Received') ) {
          # It's an email creation
    }

It seems to work OK. You could use this in a scrip to set a custom field or whatever.


The page in the bestpractical wiki is now:
http://wiki.bestpractical.com/index.cgi?OnWebCorrespond

This was very helpful.
When a ticket is created via email, I set the 'TimeLeft' field, which is otherwise unused in our organisation, to '1' as a flag to later test on.

First I disable the default Autoreply to the queue in question (Accounts) by modifying the default Autoreply on creation script, modifying its condition:
/~~~~~~~~~~~~
if ( $self->TransactionObj->Type eq "Create" ) {
  if ( $self->TicketObj->QueueObj->Name eq 'Accounts' ) { return 0; }
return 1;
}
\____________
Then I create a scrip in the 'Accounts' queue that has a user-defined condition for 'autoreply to requestors'.
This is where I do the work on setting the 'TimeLeft' field:
/~~~~~~~~~
my $trans = $self->TransactionObj;
# OnCreate:
return 0 unless $trans->Type eq "Create";
# Get the message attachment
my $msgattr = $trans->Message->First;
return 1 unless $msgattr; # no message attachment - assume web UI
if ($msgattr->GetHeader('Received')) {
$self->TicketObj->__Set( Field => 'TimeLeft', Value => 1);
return 1;
}
return 1;
\__________

Thanks.
Kind regards.

--
Luke Vanderfluit.
Analyst/Programmer.
Internode Systems Pty. Ltd.

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com


We're hiring! Come hack Perl for Best Practical: 
http://bestpractical.com/about/jobs.html

Reply via email to