{"id":19648414,"url":"https://github.com/bestpractical/rt-extension-extractcustomfieldvalues","last_synced_at":"2025-04-28T16:30:26.745Z","repository":{"id":604502,"uuid":"241013","full_name":"bestpractical/rt-extension-extractcustomfieldvalues","owner":"bestpractical","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T20:21:17.000Z","size":228,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T09:25:22.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://search.cpan.org/dist/RT-Extension-ExtractCustomFieldValues","language":"Perl","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bestpractical.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-07-01T20:30:34.000Z","updated_at":"2024-11-17T11:05:39.000Z","dependencies_parsed_at":"2023-02-10T12:46:24.761Z","dependency_job_id":null,"html_url":"https://github.com/bestpractical/rt-extension-extractcustomfieldvalues","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestpractical%2Frt-extension-extractcustomfieldvalues","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestpractical%2Frt-extension-extractcustomfieldvalues/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestpractical%2Frt-extension-extractcustomfieldvalues/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestpractical%2Frt-extension-extractcustomfieldvalues/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bestpractical","download_url":"https://codeload.github.com/bestpractical/rt-extension-extractcustomfieldvalues/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251345714,"owners_count":21574762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:48:21.028Z","updated_at":"2025-04-28T16:30:26.422Z","avatar_url":"https://github.com/bestpractical.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n    RT::Extension::ExtractCustomFieldValues - extract CF values from email\n    headers or body\n\nRT VERSION\n    Works with RT 4.0, 4.2, 4.4, 5.0\n\nDESCRIPTION\n    ExtractCustomFieldValues provides an \"ExtractCustomFieldValues\" scrip\n    action, which can be used to scan incoming emails to set values of\n    custom fields.\n\nINSTALLATION\n    perl Makefile.PL\n    make\n    make install\n        May need root permissions\n\n    make initdb\n        Only run this the first time you install this module.\n\n        If you run this twice, you may end up with duplicate data in your\n        database.\n\n        If you are upgrading this module, check for upgrading instructions\n        in case changes need to be made to your database.\n\n    Edit your /opt/rt5/etc/RT_SiteConfig.pm\n        If you are using RT 4.2 or greater, add this line:\n\n            Plugin('RT::Extension::ExtractCustomFieldValues');\n\n        For RT 4.0, add this line:\n\n            Set(@Plugins, qw(RT::Extension::ExtractCustomFieldValues));\n\n        or add RT::Extension::ExtractCustomFieldValues to your existing\n        @Plugins line.\n\n    Restart your webserver\n\nUSAGE\n    To use the ScripAction, create a Template and a Scrip in RT. Your new\n    Scrip should use a ScripAction of 'Extract Custom Field Values'. The\n    Template consists of the lines which control the scanner. All\n    non-comment lines are of the following format:\n\n        \u003ccf-name\u003e|\u003cHeadername\u003e|\u003cMatchString\u003e|\u003cPostcmd\u003e|\u003cOptions\u003e\n\n    where:\n\n    *cf-name*\n        The name of a custom field (must be created in RT). If this field is\n        blank, the match will be run and Postcmd will be executed, but no\n        custom field will be updated. Use this if you need to execute other\n        RT code based on your match.\n\n    *Headername*\n        Either a Name of an email header, \"body\" to scan the body of the\n        email or \"headers\" to search all of the headers.\n\n    *MatchString*\n        A regular expression to find a match in the header or body. If the\n        MatchString matches a comma separated list and the CF is a\n        multi-value CF then each item in the list is added as a separate\n        value.\n\n    *Postcmd*\n        Perl code to be evaluated on $value, where $value is either $1 or\n        full match text from the match performed with \u003cMatchString\u003e\n\n    *Options*\n        A string of letters which may control some aspects. Possible options\n        include:\n\n        *q* - (quiet)\n            Don't record a transaction when adding the custom field value\n\n        *** - (wildcard)\n            The MatchString regex should contain _two_ capturing groups, the\n            first of which is the CF name, the second of which is the value.\n            If this option is given, the \u003ccf-name\u003e field is ignored.\n            (Supercedes '+'.)\n\n        *+* - (multiple)\n            The MatchString regex will be applied with the /g option and all\n            matching values will be added to the CF, which should probably\n            be a multi-value CF for best results. (Superceded by '*'.)\n\n  Separator\n    You can change the separator string (initially \"\\|\") during the template\n    with:\n\n        Separator=\u003canyregexp\u003e\n\n    Changing the separator may be necessary, if you want to use a \"|\" in one\n    of the patterns in the controlling lines.\n\n  ValueSeparator\n    You can change the separator string for multi-value customfields\n    (initially \",\") in the template with:\n\n            ValueSeparator=\u003canyregexp\u003e\n\n    Changing the mult-value separator may be necessary since your source may\n    use a list of values separated by spaces or ', ' or ';' etc.\n\n  Examples\n    For reference, a template with these examples is also installed during\n    make initdb. See the CustomFieldScannerExample template for examples and\n    further documentation. The installed template also makes it easy to cut\n    and paste the examples into your own template.\n\n    1. Put the content of the \"X-MI-Test\" header into the \"testcf\" custom\n    field:\n            testcf|X-MI-Test|.*\n\n    2. Scan the body for Host:name and put name into the \"bodycf\" custom\n    field:\n            bodycf|Body|Host:\\s*(\\w+)\n\n    3. Scan the \"X-MI-IP\" header for an IP-Adresse and get the hostname by\n    reverse-resolving it:\n            Hostname|X-MI-IP|\\d+\\.\\d+\\.\\d+\\.\\d+|use Socket; ($value) = gethostbyaddr(inet_aton($value),AF_INET);\n\n    4. scan the \"CC\" header for an many email addresses, and add them to a\n    custom field named \"parsedCCs\". If \"parsedCCs\" is a multivalue CF, then\n    this should yield separate values for all email adress found.\n            parsedCCs|CC|.*|$value =~ s/^\\s+//; $value =~ s/\\s+$//;\n\n    5. Looks for an \"Email:\" field in the body of the email, then loads up\n    that user and makes them privileged The blank first field means the\n    automatic CustomField setting is not invoked.\n            |Body|Email:\\s*(.+)$|my $u = RT::User-\u003enew($RT::SystemUser); $u-\u003eLoadByEmail($value); $u-\u003eSetPrivileged(1)|\n\n    6. Looks for any text of the form \"Set CF Name: Value\" in the body, and\n    sets the CF named \"CF Name\" to the given value, which may be multi-line.\n    The '*' option controls the wildcard nature of this example.\n            Separator=!\n            !Body!^Set ([^\\n:]*?):\\s*((?s).*?)(?:\\Z|\\n\\Z|\\n\\n)!!*\n\n    7. Looks for the regex anywhere in the headers and stores the match in\n    the AllHeaderSearch CF\n            AllHeaderSearch|Headers|Site:\\s*(\\w+)\n\n    8. If you need to dynamically build your matching, and want to trigger\n    on headers and body and invode some arbitrary code like example 5\n            Separator=~~\n        {\n            my $action = 'use My::Site; My::Site::SetSiteID( Ticket =\u003e $self-\u003eTicketObj, Site =\u003e $_ );';\n\n            for my $regex (My::Site::ValidRegexps) {\n                for my $from ('headers', 'body') {\n                    $OUT .= join '~~',\n                        '', # CF name\n                        $from,\n                        $regex,\n                        $action;\n                   $OUT .= \"\\n\";\n               }\n           }\n        }\n\nAUTHOR\n    Best Practical Solutions, LLC \u003cmodules@bestpractical.com\u003e\n\n    Based on code by Dirk Pape \u003cpape@inf.fu-berlin.de\u003e.\n\nBUGS\n    All bugs should be reported via email to\n\n        L\u003cbug-RT-Extension-ExtractCustomFieldValues@rt.cpan.org|mailto:bug-RT-Extension-ExtractCustomFieldValues@rt.cpan.org\u003e\n\n    or via the web at\n\n        L\u003crt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-ExtractCustomFieldValues\u003e.\n\nLICENSE AND COPYRIGHT\n    This software is Copyright (c) 2007-2020 by Best Practical Solutions,\n    LLC.\n\n    This is free software, licensed under:\n\n      The GNU General Public License, Version 2, June 1991\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestpractical%2Frt-extension-extractcustomfieldvalues","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbestpractical%2Frt-extension-extractcustomfieldvalues","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestpractical%2Frt-extension-extractcustomfieldvalues/lists"}