Hi all,
I have a trigger that is returning an order. The order has header data (such as order number, delivery address and a product line item array containing values for Product Code and Quantity for all the items ordered.
For each of the line items, I need to look up a value in a Google sheet based on the Product Code in the line item array in order to get a pack size for that product code.
The quantity ordered needs to be divided by the pack size to know the number of packs required.
At the end of all this, I need to complete a single action to pass the order onto our inventory system (it’s not possible to complete an action for each item ordered because the inventory system needs a single record with line items).
The action takes header values, and then requires a line items collection of all the things ordered, including the Product Code and the calculation of Quantity / Pack Size.
I’ve tried to tackle this from a number of different angles, but have finally got stuck.
My last attempt took the line items from the trigger, created a Loop From Line Items action.
For each loop, I performed a Lookup Spreadsheet Row in Google Sheets to get the Pack Size for the Product Code.
I then created a Numbers in Formatter action to do the division.
I then created a Utilities in Formatter action using the Line Itemizer (Create/Append/Prepend) with the intention of adding each Product Code and Calculated Quantity value back into line items (hoping that each loop would append the data to the existing Line-item group).
I then added a Filter action to filter on the Loop being the last item, and then attempted to use the Line Itemizer data in the final action’s Product Items collection.
But it obviously doesn’t work, because the Line Itemizer doesn’t actually continue to append data on each loop.
So my question really, is how to look up data from Google Sheets for each line item and then use the collection and fetched data to plug back into my action.
Screenshots attached.