[rt-users] Parse initial e-mail
Cornell Green
cornellgreen at gmail.com
Fri Feb 25 15:48:02 EST 2005
I am attempting to parse the initial email that initiates a ticket.
I have created a custom scrip. This part I have working:
Description: $Descrip_name (not important)
Condition: User Defined
Action: Notify CCs as Comment
Template: $Templ_name (again, not important; but the template itself
included below)
Stage: TransactionCreate
Custom Condition:
if($self->TicketObj->Status eq 'new' and
$self->TransactionObj->CreatorObj->EmailAddress() =~ /$match_pattern/
){
return 1;
}
...for privacy I have, obviously, substituted "$match_pattern" for the
*actual* pattern the condition contains...
Custom action preparation code:
my $self = $Transaction;
my @lines = split(/\n/,$self->TicketObj->Transactions->First->Attachments->First->Content());
foreach my $this_line ( @lines ){
if ( $this_line =~ /Caller\'s Phone Number:/ ){;
my ($caller) = ($this_line);
return $caller;
} else {
next;
}
}
1;
Custom action cleanup code:
1;
The custom scrip this triggers:
Subject: AutoReply: Toll-free support call
A call from {$caller} has created [{$rtname} #{$Ticket->id()}] in the
Trouble Ticket system.
Unfortunately, the output I receive is:
A call from has created [garagenet.com #NNN] in the Trouble Ticket system.
Clearly, although I have figured out how to create the correct trigger
condition, I have *not* determined how to parse the initial email.
Does anyone have any idea what I'm doing wrong? Is there any tutorial
on the RT Ticket/Transaction object schema, as it relates to accessing
aspects of it in a custom scrip?
Any help will, truly, be gratefully appreciated. Thanks in advance...
peace
More information about the rt-users
mailing list