Hi guys,
I’m stuck on a task where I need to send a payload in a certain structure to an api endpoint.
Basically it creates a sales order in an ERP system using the data from glide.
This is the json template:
{
“OrderNo”: 0,
“DeliveringCustomer”: $erpid,
“InvoicingCustomer”: $erpid,
“StoreId”: 1,
“SalesOrderDTORows”: [
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
]
}
All good but the tricky part is this:
“SalesOrderDTORows”: [
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
]
If I send an order where there’s multiple product rows it sends them as
{
“ProductId”: $prodcode,$prodcode,$prodcode,$prodcode,
“Quantity”: $qtys,$qtys,$qtys,$qtys
}
When it should send them as separate entities:
{
“OrderNo”: 0,
“DeliveringCustomer”: $erpid,
“InvoicingCustomer”: $erpid,
“StoreId”: 1,
“SalesOrderDTORows”: [
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
{
“ProductId”: $prodcode,
“Quantity”: $qtys
}
]
}
I’m kinda thinking in the line of using this json object I’ve created per sales row:
{ “ProductId”: “6430057275030”, “Quantity”: 1 }
And joining them as a list but only for the relevant sales order. But can I have a json object in a json template and I’m overthinking how to create the joined list of objects to only include the data for the specific order. So the question is, how would I go about this?
I can send orders with single rows and it works fine.