How to parse the description field for values to put into other Jira Custom fields

This workaround is meant to help projects where it is necessary to get information from an email request's description field and enter it into specific Jira Custom fields. This saves time in a daily routine by not having to enter the values manually.

For this, we can utilize Automation For Jira (A4J) with some Jira Custom Fields. I used an Email request related to HR - New Hire as an example, where a user will send the new hire information via email based on a list.

You will need system automation to load the same default list in your browser email - this process can be done with iCIMS or other tools automation in your system. This method can be used for other purposes like Email Requests containing a shopping list, an incident, etc.

Important related documentation:

Smart values - text
Text functions
Regular expressions

Workaround steps:

I was able to get the information by rows in the Description field and throw that information into Jira's fields.

The bulk of the work is done by the Smart Value match() expression with Regular expressions in A4J.

This example would capture the entire Description, which isn't very useful.:

  • {{issue.description.match("(.*)")}}

The feature we will be using from Regular Expressions is the Capture Group:

The Regular Expression will take different forms depending on what you are trying to capture, but here is a practical example to give an idea of how it can be used.

Let's say the Email Request creates an Issue with a Description with this Information:

Employee Name: John Doe
Employee Number: AB00123
Hire Date: 31/02/2023

Each of these Smart Values will capture their respective lines:

{{issue.description.match("^Employee Name: (.*)$")}}
{{issue.description.match("^Employee Number: (.*)$")}}
{{issue.description.match("^Hire Date: (.*)$")}}

Written plainly, they are saying:

  • "Give me the text after Employee Name to the end of the line."
  • "Give me the text after Employee Number to the end of the line."
  • "Give me the text after Hire Date to the end of the line."

Where all require that the Strings it is checking for are at the beginning of the line.

You will be able to get the row info after this delimited text. The automation rule will work as in the screen recording below:

Also, in order to parse a text field to a date field format, the date filled in the text field will need to be in the format "yyyy-MM-dd". Otherwise, you will receive the error below:

Error editing issues
Project-Key (The Date form must be of the format "yyyy-MM-dd" (customfield_xxxx))

Note: The email must be without any formatting, otherwise, it will copy the HTML for color, letter format, etc, as shown in this screenshot:

Screen Shot 2022-05-06 at 13.16.36.png

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events