epipko
03/11/2023, 7:48 PMbdw429s
03/11/2023, 7:55 PMbdw429s
03/11/2023, 7:56 PMfulfillment_order_line_items key in your fulfillment_json struct is a string, not a nested structbdw429s
03/11/2023, 7:56 PMbdw429s
03/11/2023, 7:58 PMepipko
03/12/2023, 12:08 AMepipko
03/12/2023, 12:09 AMselect * from ep;
FULFILLMENT_LINE_ID LINE_ITEM_ID UNITS_PAKD
12254030430387 12100547903667 1
12254030463155 12100547936435 1
<cfquery name="q1" datasource="#REQUEST.T#">
select LISTAGG('{'||'"id":'||fulfillment_line_id||','||'"quantity":'||units_pakd||'}', ',') line_items
from ep
</cfquery>
Above query returns:
{"id":12254030430387,"quantity":1},{"id":12254030463155,"quantity":1}
<cfset fulfillment_json =
{
"fulfillment": {
"location_id": "30406673",
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": #fulfillment_order_id#,
"fulfillment_order_line_items": [
#q1.line_items#
]
}
],
"tracking_info": {
"number": #invoiced_ecomm_orders.trkg_nbr#,
"url": "www.usps.com"
},
"notify_customer": false,
"message": "Your package was shipped."
}
}
/>epipko
03/12/2023, 12:10 AMbdw429s
03/12/2023, 1:37 AMbdw429s
03/12/2023, 1:38 AMbdw429s
03/12/2023, 1:42 AMfulfillment_json, for example, does NOT contain JSON, but instead a CFML struct. (JSON is a string)bdw429s
03/12/2023, 1:43 AMepipko
03/12/2023, 6:04 AM