Hello,
I tried to get a nunjuck post function (through jmwe) working on Issues with subtasks.
The postfunction in question is:
Subtask Workflow postfunction:
Set issue fields post-function;
Target Issue = Parent of current subtask;
Fields to update: "DoneDesc"
Code:
{{ parentIssue.fields.customfield_[ID of DoneDesc }}
{% if issue.fields["Issue Type"].name== 'Subtask1' %}
{{ 'Subtask1:' }}
{{ issue.fields.customfield_[ID of DoneDesc Subtask1] }}
{% else %}
{{ 'Subtask2:' }}
{{ issue.fields.customfield_[ID of DoneDesc Subtask2] }} {% endif %}
What I want to accomplish: Fill the DoneDesc of my parent Issue when my subtask is done, but keep everything that was already in the Field. So if I e.g. have 2 Subtasks done, the Field should have all 2 SubtaskDoneDescs and whatever else I filled in beforehand.
If tested on my subtask (in the editor) this code does exactly that, but when tested with real issues and workflows the field is always overwritten, not appended.
Could someone explain to my if I did someting wrong here and why the editor Nunjuck template test works but not my Issues?
Kind regards