Using Liquid Templating with Jira Custom Field Mapping

Overview

Liquid templating variables are a shortcut for populating supported FireHydrant fields with dynamically generated data from the FireHydrant API, for example default Jira ticket text generated by a Jira Cloud or Jira Server runbook step.  Liquid is also supported for literal values passed into Jira custom fields.

Considerations

Data type alignment

Jira requires that the data type from the literal field match the data type of the Jira destination field, for example, a literal free-form text value to a Jira free-form text field or a literal configured array to a Jira array field.

Array handling for Jira labels 

If you are planning to pass data into the Jira Labels field any spaces in an array item string will be turned into a separate Jira label (e.g. Login Portal will become 2 separate labels, Login and Portal). To prevent this a placeholder character must be added, such as a hyphen.

Example

In this example, we’ll pass the following dynamic variables to the Jira Labels field:

  • Impacted functionalities
  • Incident severity
  • Incident number

Configure the field mapping

From the Integrations tiles, choose to edit the Jira configuration.  For a Jira project of interest, add a literal value field mapping with the destination as the Jira Labels External field.

Screen_Shot_2022-12-02_at_10.44.07_AM.png

Impacted functionalities liquid syntax

The impacted functionalities array contains both the name and ID, but we only want the name. In this example, we’ve replaced any spaces in functionality names with a “-”.   This is the liquid code to pass in an array of impacted functionality names where each impacted functionality will get its own Jira label:

{{incident.functionalities | map: "name" | join: "," | replace: " ", "-" }}

Incident severity liquid syntax

Now we'll add a label for current incident severity, which looks like this:

{{incident.severity}}

Incident number liquid syntax

Lastly, we'll add a label for incident number, which looks like this:

{{incident.number}}

Putting it all together

Here is the liquid code all together:

{{incident.functionalities | map: "name" | join: "," | replace: " ", "-" }}, {{ incident.severity }}, {{ incident.number }}

Copy this into the Value field.  Click Update field mapping to save the configuration.

Use the mapping in a Jira incident ticket

Create a runbook step pointing to the Jira project with your new Label mapping.

When an incident ticket is created with the mapped project fields, the impacted functionalities, incident number, and severity are passed to the Jira Labels field.

Screen_Shot_2022-12-02_at_11.26.56_AM.png

 

Once the field mapping is configured, the Jira Labels will also be populated for any action item that generates an associated Jira ticket in that same project.

Screen_Shot_2022-12-02_at_11.27.17_AM.png

Additional references

 

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more
Contact Our Support Team
Got a Question or Suggestion? We're here to help!
Follow us on Twitter
Get the latest news and updates first