โ06-11-2020 11:06 PM
How to build raw POST body using mapper? Need to achieve below
{
โconditionsโ: [
{
โnameโ: โlearningevent_idโ,
โoperatorโ: โ==โ,
โvalueโ: โ12345โ
}
]
}
I am able to achieve its missing [ ]
Expression for mapper below
Solved! Go to Solution.
โ06-12-2020 12:21 AM
Hi @npise,
You could put sl.ensureArray($requestBody.conditions) in an expression in a Mapper after the one you described, and assign it to the $requestBody.conditions target path.
Alternatively, if you want to achieve everything in one Mapper, you can put sl.ensureArray({}.extend({name:โlearningevent_idโ, operator:โ==โ,value:$learningevent_id})) in the expression and assign it to the $requestBody.conditions target path.
BR,
Dimitri
โ06-12-2020 12:21 AM
Hi @npise,
You could put sl.ensureArray($requestBody.conditions) in an expression in a Mapper after the one you described, and assign it to the $requestBody.conditions target path.
Alternatively, if you want to achieve everything in one Mapper, you can put sl.ensureArray({}.extend({name:โlearningevent_idโ, operator:โ==โ,value:$learningevent_id})) in the expression and assign it to the $requestBody.conditions target path.
BR,
Dimitri
โ06-12-2020 11:46 AM
Thank you so much this worked!!
i was able to achieve that in one input expression
sl.ensureArray({}.extend({name:โlearningevent_idโ, operator:โ==โ,value:$learningevent_id}))