We have recently hired an outside company to be our "Tier-One" tech support. Every call they log sends us an email. We are filtering out the "Escalation" tickets and having those one added to our Helpdesk RT queue (Thanks to procmail). Now we need to parse the subject line of these Escalated tickets and pull out the "Tier-One" Call ID # and have that dumped into a custom field. My perl skills are limited to none, so I have tried to put together a few other scrips that I user and/or found to create one, but it is not working as I expect (it seems like it does nothing at all, either never applied, or is applied, but does not fill in the CustomField)... so I come to the exports to look over my work....
Every one of the incoming "Escalation" emails will have a set FROM and SUBJECT field.... FROM: [email protected] SUBJECT: FooBar Helpdesk Call - 1234567 - Escalation Condition: On Create Action: User Defined Template: Global template: Blank Stage: TransactionCreate --------------------------------------------------------------------- CUSTOM CONDITION --------------------------------------------------------------------- --left blank-- --------------------------------------------------------------------- CUSTOM ACTION PREPARATION CODE --------------------------------------------------------------------- # Setup the check for the email address my $from_address = '[email protected]'; # Get who created this ticket and exit if it doesn't # match the system address from above my $requestor_address = lc($self->TicketObj->RequestorAddresses); if ($requestor_address ne $from_address) { ## Not from my company, so don't want to parse the subject line return 0; } else { return 1; } --------------------------------------------------------------------- CUSTOM ACTION CLEANUP CODE --------------------------------------------------------------------- ### Extract fields from e-mail ## my $MyName = "Scrip DNS:35:Commit (New Ticket)"; my $Transaction = $self->TransactionObj; my $CurrentUser = $Transaction->CurrentUser; my $Ticket = $self->TicketObj; my $qNagme = 2; my $NewPri = 90; my $Content = $Ticket->Subject; # The seperator is my $sep = " - "; chomp $sep; $Content =~ s/\A$sep\n//s; chomp $Content; my ($issueCO, $issueID, $issueType) = split($sep, $Content); set_custom('Escalation_ID',$issueID, 0); # set_custom('Escalation_Type', $issueType, 0); # set_custom('Incoming_Co', $userCO, 0); ### Leave this until last, it triggers the ack e-mail to requestor $Ticket->SetPriority($NewPri); ### Sets custom field value ### Usage: set_custom($field_name, $field_value, $record_transaction) sub set_custom { my ($CFName, $CFValue, $record) = @_; my $cf = RT::CustomField->new($RT::SystemUser); my ($id,$msg) = $cf->LoadByName(Name=>$CFName,); if (!$id) { $RT::Logger->debug("$MyName: Couldn't load CF ($CFName)"); return undef; } ($id, $msg) = $Ticket->AddCustomFieldValue (Field=>$cf, Value=>$CFValue, RecordTransaction=>$record ? $record : 0); } -- http://gentgeen.homelinux.org ############################################################# Associate yourself with men of good quality if you esteem your own reputation; for 'tis better to be alone then in bad company. - George Washington, Rules of Civility
_______________________________________________ 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
