You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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}},{{/}}
{{/}}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.