I improved this a bit.
In the make array query, just return the array rather than set the temp var.
// jsMakeBulkBundleArray
var newData = [];
tblLineItems.selectedRow.data.forEach(row => {
newData.push({
line_item_id: row.line_item_id,
bundled_sku: tblProducts.selectedRow.data[0].sku
})
});
return newData
In your main query use the returned value to pass it to the bulk query:
// jsBulkBundle
jsMakeBulkBundleArray.trigger({
onSuccess:function(data) {
qryBulkBundle.trigger({
additionalScope: {
dataArray: data
}
})
}
});
And then use {{dataArray}}
as the Array of records to update in your SQL query.
25% fewer moving parts to keep track of.