How do I map an email field to a JIRA Custom Field?

Scenario

An email contains the following structure is desired to be processed into JIRA custom fields. For simplicity, assuming these Custom Fields are text(255) types, not related to JIRA fields, which have constraining valid values.

ID: 123 STATUS: in Progress CLASSIFICATION: PROBLEM_ADMINISTRATION/CONFIGURATION COMPONENT: one of my components list SUBMITTER: user E-MAIL: user's name (no need to verify) PRIO: 3 DETAILS: Is description of the bug CUSTOMERNUMBER: Is custom field, a number from customer.

Solution

since 1.2

1 Enable an appropriate field processor

JEMH knows how to handle some specific message formats, the one you show is one of them (colon suffix key: value). Go to Field Processors and ensure that is enabled.

2 Set a default project and reporter

Until you want to deal with intricacies of project selection and user creation, setting a default project, and a user with privilege in that project will get you up and running quickly.

3 Create a Test Case email

JEMH TestCases allow you to work out configurations quickly. Create an example and add your content above, that yields something like:

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: This is a starting email template, update as required From: "Andy Brook" <andy@localhost> To: notest@jira.myco.net Content-Type: text/plain; charset=UTF-8 ID: 123 STATUS: in Progress CLASSIFICATION: PROBLEM_ADMINISTRATION/CONFIGURATION COMPONENT: one of my components list SUBMITTER: user E-MAIL: user's name (no need to verify) PRIO: 3 DETAILS: Is description of the bug CUSTOMERNUMBER: Is custom field, a number from customer.

4 Create a Custom field

Create a Custom Field, for example a Text(255 chars), called 'External ID'.

5 Setup Aliases

The Magic you need is JEMH Aliases, this feature allows you to map between an incoming 'key' and an actual JIRA custom field. Some observations, your values are all one liners, do you need multiline support, if so, JEMH can do that.

To get the Custom Field routing, add an alias where the key is 'CLASSIFICATION' and the value is 'text255'.

A note on fields. If a field is defined in a format JEMH recognizes as being appropriate, it gets consumed and will not form part of the final email. If that field does not match either an existing Custom Field or an Alias, then it will just disappear. By ensuring that fields are appropriately mapped, you can achieve the desired result.

6 Execute the TestCase

After executing the test case, all the fields above will 'go' because they matched the key:value format. Of those keys, the CLASSIFICATION field will be matched to the appropriate Custom Field, as you will see in the issue.