(JMWE or other) Set a Text Field (multi-line) by concatenating from subtasks (with a separator)

Ted Timar October 18, 2021

Jira Cloud...

I would like to create a multi-line text field by concatenating the values of an arbitrary multi-line text field from all subtasks.  The values would be separated by a newline.

Better yet would be to generate the value from each subfield with (KEY-123 - Value).

The use case is when reviewing an issue to confirm something, we would need to confirm each of the subtasks.   We would like to (on a particular transition) bring the values all to one place.

The source field could be Description (ideally prepended by Key).  The destination field would definitely be a custom field.

I've tried the following using JMWE:

     {{issue.fields.subtasks | join(",\n" , "description")}}

This works if I use "key" (lowercase only) instead of "description".

I've also tried:
     {{issue.fields | field("fields") | join(",\n", "description")}}

This even works for "summary", but still not for "description".

1 answer

1 accepted

3 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 18, 2021

Hi @Ted Timar ,

you can easily achieve this using a Set Issue Fields (JMWE app) post function. Select the destination custom field as the field to set, and use this as the value:

{% for subtask in issue | subtasks( "description" ) %}
{{subtask.key}} - {{subtask.fields.description}}
{% endfor %}

That code assumes you want to gather values from each sub-task's Description field - replace the sub-task field (here "description") on lines 1 and 2 with the desired field ID (such as customfield_12345 for a custom field).

Ted Timar October 18, 2021

That's exactly what I needed.
Thanks so much for your help @David Fischer .

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events