I'm trying to update the list of components on an Epic to match the components on all of it's child issues, whenever any child has it's components updated.
For this example I have a single Epic with two child User Stories. They each have the following components:
- User Story 1: Test 1
- User Story 2: Test 2, Test 3
- Epic: (should update to: Test 1, Test 2, Test 3)
I can't remove specific components from the parent because they should remain if they exist on other child issues, so I've written one automation to delete all components from the parent whenever a child's components are edited. I'm now trying to write a second automation which will be triggered by that parent field edit.
The second automation should collect the components from each of the child issues and then update the parent components field.
The automation uses a branch rule "for: Children"
Then: Create variable, named: "childComponents" with smart value:
{{issue.Components.asJsonObjectArray("name")}}Then back on the main branch: Edit issue fields, selected fields: Components, Additional fields:
{
"fields": {
"components" : {{childComponents}}
}
}However, the audit log returns the error:
Error while parsing additional fields. Not valid JSON.
I've enabled a manual trigger and value logging for debugging, which returns:
[{ "name": "Test 1" }], [{ "name": "Test 2" },{ "name": "Test 3" }]
How can I concatenate the array values so that I can use the final array to update the parent components? Something like:
[{ "name": "Test 1" },{ "name": "Test 2" },{ "name": "Test 3" }]
Alternatively... is there a better way of doing all this?
Many thanks!
