[rt-users] Possible for contents in subject line to map into customfields?

Schultz, Eric ESchultz at corp.untd.com
Tue Jul 18 11:32:24 EDT 2006


I use this scrip to check the incoming To: address and use that to set
the CF - it could easily be adapted to look at the incoming subject
instead.

Custom action prep code:
--------------------------- 
# Get the message attachment
my $msgatt = $self->TransactionObj->Attachments->First;
return 0 if (!$msgatt);  # if no message attachment - assume web UI
return 0 if (!$msgatt->GetHeader('Received'));  # exit if not email
message

my $team = $msgatt->GetHeader('To');
($team) = ($team =~ /(\w+)\@\w+/);
return 0 if ($team eq 'billingops');  # exception for default address
$self->TicketObj->SetSubject( "[$team] " . $self->TicketObj->Subject );
---------------------------

Custom action cleanup code:
---------------------------
my $msgatt = $self->TransactionObj->Attachments->First;
my $team = $msgatt->GetHeader('To');
($team) = ($team =~ /<(\w+)\@.+$/);

my $cf = RT::CustomField->new( $RT::SystemUser );
$self->TicketObj->AddCustomFieldValue( Field => 19, Value => $team,
RecordTransaction => 0 ) if
($self->TicketObj->CustomFieldValues($cf->Id)->Count < 1);
}
---------------------------

Only "problem" there is that the field ID is hardcoded.  However, I
prefer this to looking up the CF name and then getting the ID, because
it is less likely the ID of the CF will change than someone who might
want to rename it.

Hope this helps.

Eric Schultz
United Online

-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Tony
Graziano
Sent: Monday, July 17, 2006 4:55 PM
To: rt-users at lists.bestpractical.com
Subject: [rt-users] Possible for contents in subject line to map into
customfields?

We have been using RT for a couple of years now. We have it fielding
phone calls from our helpdesk queue since the pbx can send voice mails
as an email attachment.

I actually have two questions (RTv3.6):

1. If the "requestor" of the ticket is our phone system, is there a
scrip or custom condition that can be met to create the ticket and
notify the admin's etc. but not the requestor if it is a specific
requestor?

2. We get caller ID name and number in the subject lines (usually) and
would be interested to know if there is a way a scrip could also write
the information into the custom fields or not. 

Thanks,

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

Community help: http://wiki.bestpractical.com
Commercial support: sales at bestpractical.com


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



More information about the rt-users mailing list