https://rt-wiki.bestpractical.com/index.php?title=ExtractCustomFieldValues&feed=atom&action=historyExtractCustomFieldValues - Revision history2024-03-29T15:18:50ZRevision history for this page on the wikiMediaWiki 1.37.2https://rt-wiki.bestpractical.com/index.php?title=ExtractCustomFieldValues&diff=1235&oldid=prevAdmin: 3 revisions imported2016-04-06T20:08:59Z<p>3 revisions imported</p>
<p><b>New page</b></p><div>The [[ExtractCustomFieldValues]] extension permits use of a relatively simple template to set Custom Fields with data extracted via regexps.<br />
<br />
[http://search.cpan.org/dist/RT-Extension-ExtractCustomFieldValues/ RT::Extension::ExtractCustomFieldValues on CPAN]<br />
<br />
Syntax:<br />
<br />
cf-name | Headername or "Body" | MatchString(re) | Postcmd | Options<br />
<br />
Example usage:<br />
<br />
Issue Type|X-QCF-IssueType|.*||q|<br />
<br />
(option q = don't record a transaction for adding the CFV)<br />
<br />
1. Create a Scrip: [[ExtractCF]] On Create Extract Custom Field Values with template [[CustomFieldExtract]] Script Fields:<br />
<br />
Description: ExtractCF Condition: On Create Action: Extract Custom Field Values<br />
Template: CustomFieldExtract Stage: Transaction Create<br />
<br />
2. Create Template [[CustomFieldExtract]] for the specific queue, which contains:<br />
<br />
Company ID|X-QCF-Companyid|.*||q|<br />
Client Type|X-QCF-Clienttype|.*||q|<br />
Organization Name|X-QCF-OrganizationName|.*||q|<br />
Name|X-QCF-Name|.*||q|<br />
Address 1|X-QCF-Address1|.*||q|<br />
Address 2|X-QCF-Address2|.*||q|<br />
<br />
Spaces are allowed in the RT custom field names, but will not work in the Headers.<br />
<br />
To extract info from the Body of the message: Use a key word such as "Question-comment:" to import into your custom field "Details":<br />
<br />
Details|Body|Question-comment-&gt;(.+)$|q|<br />
<br />
There were some errors when using a ":" after the header name, such as<br />
<br />
Resolution|Body|Resolution:(.+)$|q|<br />
<br />
since it was interpreted as a command. Had better luck using "-&gt;" instead.<br />
<br />
----<br />
<br />
Changes to [[RT SiteConfig|RT_SiteConfig]].pm for extracting custom fields:<br />
<br />
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|RT_SiteConfig]].pm:<br />
<br />
Set($UseTransactionBatch , 1); # and restart the web server<br />
<br />
----<br />
<br />
Capturing CC (Carbon Copy) addresses into RT<br />
<br />
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.<br />
<br />
Create custom field for your queue called [[CarbonCopy]].<br />
<br />
In template, [[CustomFieldExtract]]:<br />
<br />
CarbonCopy|Cc|.*||q|<br />
<br />
In template Transaction (in this case, On Create Notify [[AdminCcs]] with template Transaction, Stage:[[TransactionBatch]]):<br />
<br />
Copied to: {$Ticket-&gt;FirstCustomFieldValue('CarbonCopy');}<br />
<br />
Then each creation autoreply will have the list of which address(es) was CC'd.<br />
<br />
updated by Mark Sallee - May 2010</div>Admin