ExtractCustomFieldValues

From Request Tracker Wiki
Jump to navigation Jump to search

The ExtractCustomFieldValues extension permits use of a relatively simple template to set Custom Fields with data extracted via regexps.

RT::Extension::ExtractCustomFieldValues on CPAN

Syntax:

cf-name | Headername or "Body" | MatchString(re) | Postcmd | Options

Example usage:

Issue Type|X-QCF-IssueType|.*||q|

(option q = don't record a transaction for adding the CFV)

1. Create a Scrip: ExtractCF On Create Extract Custom Field Values with template CustomFieldExtract Script Fields:

Description: ExtractCF  Condition: On Create  Action: Extract Custom Field Values
Template: CustomFieldExtract  Stage: Transaction Create

2. Create Template CustomFieldExtract for the specific queue, which contains:

Company ID|X-QCF-Companyid|.*||q|
Client Type|X-QCF-Clienttype|.*||q|
Organization Name|X-QCF-OrganizationName|.*||q|
Name|X-QCF-Name|.*||q|
Address 1|X-QCF-Address1|.*||q|
Address 2|X-QCF-Address2|.*||q|

Spaces are allowed in the RT custom field names, but will not work in the Headers.

To extract info from the Body of the message: Use a key word such as "Question-comment:" to import into your custom field "Details":

Details|Body|Question-comment->(.+)$|q|

There were some errors when using a ":" after the header name, such as

Resolution|Body|Resolution:(.+)$|q|

since it was interpreted as a command. Had better luck using "->" instead.


Changes to RT_SiteConfig.pm for extracting custom fields:

We needed more contact info included in messages created for new tickets than RT's default was providing. So we had to enable this in RT_SiteConfig.pm:

Set($UseTransactionBatch , 1);   # and restart the web server

Capturing CC (Carbon Copy) addresses into RT

Did you ever want to know who was CC'd on an original message to RT, but couldn't see that information after it was processed by RT? Here is how to grab the Cc: field into a custom field and display it at ticket creation.

Create custom field for your queue called CarbonCopy.

In template, CustomFieldExtract:

CarbonCopy|Cc|.*||q|

In template Transaction (in this case, On Create Notify AdminCcs with template Transaction, Stage:TransactionBatch):

Copied to: {$Ticket->FirstCustomFieldValue('CarbonCopy');}

Then each creation autoreply will have the list of which address(es) was CC'd.

updated by Mark Sallee - May 2010