/
Handling Changes in JMWE Cloud insightFieldValue Nunjucks Filter with Version 1.2.32-AC

Handling Changes in JMWE Cloud insightFieldValue Nunjucks Filter with Version 1.2.32-AC

Summary

With the release of JMWE Cloud version 1.2.32-AC, changes have been made to the insightFieldValueNunjucks filter, which may impact existing scripts that rely on it. This article explains the change and guides you through updating your scripts to accommodate the new behavior.

Background

In JMWE version 1.2.32-AC, we addressed a bug (MWEC-2302) related to the insightFieldValuefilter. The bug caused the filter to only retrieve a single user from user attributes when multiple users were expected. This issue arose because JMWE called a Jira API endpoint that returned a flattened version of complex objects rather than the original structure.

To resolve this, JMWE now calls a more accurate Jira API endpoint that returns the full structure of the object, including arrays where applicable. As a result, the insightFieldValuefilter's behavior has changed.

Impact of the Change

Scripts that previously relied on the insightFieldValuefilter may now experience issues if designed to handle a single object rather than an array. Specifically:

  • Attributes as Arrays: Previously, attributes returned as a single object are now returned as an array. This change can be observed by adding additional elements to the field.

  • Replace Filter Compatibility: If your script uses the replace filter on a value returned by insightFieldValue, be aware that this filter expects a string. With the new API endpoint, an array is returned instead, which the replace filter cannot process.

Action Required

  1. Review and Update Scripts: We recommend reviewing your existing scripts that utilize the insightFieldValue filter and updating them to handle arrays where necessary. This may involve iterating over the array or selecting the appropriate element before applying additional filters like replace.

  2. Example Update:

  • Old Script:

    {{ issue | insightFieldValue("customfield_12345").attributes.Description | replace("old", "new") }}
  • Updated Script:

    {{ (issue | insightFieldValue("customfield_12345").attributes.Description[0]) | replace("old", "new") }}

Next Steps

If you encounter any issues updating your scripts, please get in touch with our support team.

Reference : Custom Filters | insightFieldValue

Related content