Abstract

This code snippet retains the only value of a multi-valued type field which can either be an array of objects or a set of values. This snippet is useful when you know that the array has only one value and hence by applying the first or last methods you can retain it.

Logic

Use the first/last filter to get the only object of the field and access the specific field for the required value.

Snippet

{# Apply the first/last filter to the array of objects. Upon that apply the field filter #}
{{ issue.fields["<Multi-valued field>"] | <filter> | field("<Value>") }}

Placeholders

PlaceholderDescriptionExample
<Multi-value field>Name of the multi-valued fieldTechnical tasks
<filter>Filter to be appliedfirst
<Value>Value to fetchvalue


Since you already know the collection of objects has only one value you could use the last filter as well.

Examples

The output of the code snippet is the only value of a multi-valued field which you could use in a template, for example to:

References

Related articles


Related issues