Hello!
I'm doing an automation that will call a REST endpoint with a JSON structure containing a 'header' with info from the task and one 'line' per subtask with info from the subtask.
Output should be something like this:
{
"YTXTCAB": "{{issue.summary}}",
"YWSCYLINSOL":
[
{
"$uuid": "{{issue.subtasks.uuid}}",
"YITMREF": "{{issue.subtasks.YITMREF}}",
"YITMDES": "{{issue.subtasks.YITMDES}}",
"YQTYPUU": "{{issue.subtasks.YQTYPUU}}",
"YEXTRCPDAT": "{{issue.subtasks.YEXTRCPDATv}}",
"YCCE3": "{{issue.subtasks.YCCE - Proyecto}}",
"YTXTLIN": "{{issue.subtasks.descripcion}}"
},
]
}
Where the inner structure is replicated for each subtask inside the array [].
The above example lines do not work, of course, as you get just one line in the array with an all the field values from all subtasks in each field. Like below:
{
"YTXTCAB": "TEST - Sage",
"YWSCYLINSOL":
[
{
"$uuid": "123-abc, 456-def",
"YITMREF": "YITMREF 1, YITMREF 2",
"YITMDES": "YITMDES 2, YITMDES 2",
"YQTYPUU": "1.0, 2.0",
"YEXTRCPDAT": "2022-02-17, 2022-02-18",
"YCCE3": "YCCE 1, YCCE 2",
"YTXTLIN": ""
},
]
}
How would you go about getting one line of the inner structure into the JSON for each subtask?
Thanks
Jorgen
I have found the solution, pasting it below:
{
"YTXTCAB": "{{issue.summary}}",
"YWSCYLINSOL":
[
{{#issue.subtasks}}
{
"$uuid": "{{uuid}}",
"YITMREF": "{{YITMREF - Código artículo}}",
"YITMDES": "{{YITMDES}}",
"YQTYPUU": "{{YQTYPUU - Cantidad a comprar}}",
"YEXTRCPDAT": "{{YEXTRCPDAT - Fecha recepción prev}}",
"YCCE3": "{{YCCE - Proyecto}}",
"YTXTLIN": "{{description}}"
}
{{^last}},{{/}}
{{/}}
]
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.