The following seemed to work alot better.
sl.ensureArray($.get(‘tranSales:inventoryDetail’))
However I am getting an error that says we cannot add a ‘inventory detail to this line’. What is happening is that even if the inventory detail does not exist it is adding it to the record as ‘null’ however netsuite does not want it added in the item list at all. See output stream below. I attempted to go back to the root mapper and add a ‘if/then’ statement but it just loops. Take a look and let me know if I am on the right track or if there is another way to exclude the ‘inventory detail’ when inventory detail does not exist in the item tree.
jsonPath($, “[‘soapenv:Body’].getResponse.readResponse.record[‘tranSales:itemList’][‘tranSales:item’][].hasOwnProperty(“tranSales:inventoryDetaill”) ? sl.ensureArray(jsonPath($, "[‘soapenv:Body’].getResponse.readResponse.record[‘tranSales:itemList’][‘tranSales:item’][][‘tranSales:inventoryDetail’][‘platformCommon:inventoryAssignmentList’][‘platformCommon:inventoryAssignment’]”)) : jsonPath($, "[‘soapenv:Body’].getResponse.readResponse.record[‘tranSales:itemList’][‘tranSales:item’][*]
(Note: if I place ‘null’ as the else then it places all of them as null)
![]()