Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • On issue creation a uniquely identifiable value is extracted from the creating email through the use of a configured regular expression/script

  • This value is set on a configured custom field.

  • The next time an email is processed by the processor it will extract a value using the same steps

  • If an existing issue is found to already have this value in the custom field, and is not in a status defined under Resolved Statuses, an issue association will be made

  • Ensure that the custom field set has the Search Template set to Free Text Searcher

    • Image RemovedImage Added

Field

Description

Require Value Match

Enabling this setting requires a valid remote system value to be found, meaning that now, many remote systems can be matched and have regexp field extracts that are applicable to that source. The only limitation is that the remote system keys must be unique in format.

If you do not enable this, comment association by regexp will not work

Use Issue Keys in the subject if valid

If enabled, issue keys present in the email subject will be used instead of using its JQL lookup.

Search in Subject

Where to search for the matching 'value' that is to be stored in a custom field, or to be searched for, for commenting instead of creating new issues if follow-up messages occur. If not checked, the Body is inferred as being the target text to scan.

Custom Field Name

The name of the custom field that will be assigned the identifying 'id' value from the remote system.

Value Type

As of JEMH 2.2.6 there are two methods for extracting values (called Value Types).  The Value Type of Regexp, combined Value Regexp is the most simple, and enables a single value to be extracted from an email's subject or body.

In more complex cases you may wish to combine extracted information from more than one part of the email.  Using the Value Type of Script allows a compound value to be created, through the parsing of a Velocity template.

Script Type

Status
colourGreen
titleSince 3.3.46

The scripting type used for the Value Script. Allows installed script engines and languages as well as Velocity.

Value Regexp

The regular expression that matches the field in either Subject or Body, used for issue association.  This regular expression must return the actual value as capture group 1, for example, a regexp of: Ticket

Code Block
#([0-9]{6})

would return a 6 digit numeric component of matching text. This value will be initially used to search for an unresolved issue with the given Custom Field containing the value, otherwise, used to populate that field during issue creation

Value Script

A custom script that extracts values from either the Subject or Body, used for issue association. This value will be initially used to search for an unresolved issue with the given Custom Field containing the value, otherwise, used to populate that field during issue creation.

Expected Match Value

For configuration time testing purposes, test case content is required, usually from a 'Basic Field Processor' description copy/paste, as the text that ends up in JIRA as an issue description will be the same text that will be scanned. The Expected Match Value will be what the eye determines is the appropriate text value that should be found by the Value Regexp (above), a mismatch or failure of any kind will be reported at configuration time.

Resolved Statuses

Identifies the optional statuses that should not be included in the search for a matching issue. Normally this would be Resolved,Closed

If this field is left empty, JEMH will fallback to excluding issues in Resolved and Closed statuses from matching, even though no statuses have been defined. This behaviour contradicts the user interface and will be improved in a future JEMH release: 

Jira Legacy
serverSystem JIRA
serverId31e1f342-5dce-3979-a43c-85899d565476
keyJEMH-6012

...

To install Script Engines see:

Example Velocity Script

Velocity Script

Email Test Case content

Code Block
#set ( $quotedBody = $u.quoteReplacement($body) )
#set ( $pattern1 = $u.createPattern("\nsignificance=([0-9]+)\n") )
#set ( $matcher1 = $u.createMatcher($pattern1, $quotedBody) )
#if ( $matcher1.find() )
##  MATCHER1 Matched
  #set ( $firstFullGroupMatch = $matcher1.group() )
##  FIRST FULL GROUP : $firstFullGroupMatch
  #set ( $firstCaptureGroup = $matcher1.group(1) )
##  FIRST CAPTURE GROUP: $firstCaptureGroup
#else
## :( No Matcher1 match
#end
#set ( $pattern2 = $u.createPattern("\nanother field=([0-9]+)\n") )
#set ( $matcher2 = $u.createMatcher($pattern2, $quotedBody) )
#if ( $matcher2.find() )
##  MATCHER2 Matched
  #set ( $secondGroupMatch = $matcher2.group() )
##  SECOND FULL GROUP: $secondGroupMatch
  #set ( $secondCaptureGroup = $matcher2.group(1) )
##  SECOND CAPTURE GROUP : $secondCaptureGroup
#else
## :( No Matcher2 match
#end
${firstCaptureGroup}-${secondCaptureGroup}
Code Block
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: [#12345678] This is a starting email template, update as required
From: andy@faraway.com
To: notest@localhost
Content-Type: text/plain; charset=UTF-8

This is a formatted email

It has lots of text including some special fields

significance=1234

More and more

another field=56789

Even more and more, here is a key/value line split over two lines

Open Date	
04/18/2012 11:55:16

...

Test Cases in the Regexp Field Processor are not to be confused with JEMH Test Cases. Here, they are a combination of two aspects:

  1. email headers

  2. decoded text body content

The configuration that is created when the processor is first enabled contains an example (see below).  You can use this as a basis for your own specific testing, updating the To: address to match your Profile's catchEmail address, and the From: address to match your remote system sender address.

...

Ensure that the desired target profile is selected for the test case, and save.  Once saved, the TestCase can be processed by hovering the cursor over the test case and clicking the Run button (green play icon):

...

Assuming the Reporter of the issue as defined in either the Regexp Field Processor or the Global Default Reporter have appropriate permissions in the target project, an issue will be created:

...

Reviewing the created issue, as shown below, this shows that:

  1. The subject field was extracted and stored in the bugzillaId custom field.

  2. That custom field 1 and custom field 2 both have values, that match the expected values set earlier (because test case payload data was used).

  3. That custom field 3 does not contain a value - if the field mapping expression does not extract a value, the field will not get a value set by this field processor configuration.

...

Association with existing issues

...