In an Integromat scenario, you often run into the need to continue only after all bindles are processed, such as at the end of an array Iterator.
For example, you’re running through the line items in an Order. Only after processing all the bundles for all line items in the array do you want to continue. So how can you do this?
Here’s an example scenario:
This scenario prints a picklist when a new Shopify order has been completed.
It creates a Google Sheet for to hold the picklist, named with the Shopify Order ID and then adds a header row to that Sheet with the Shopify order ID and the customer company name:
Then, the Iterator takes the Line Items from the order and sends them as individual bundles, adding each as a row to the Sheet:
When that’s completed (and only when completed), we want to download the Sheet as a PDF and then send it to PrintNode for local printing:
But by default these extra steps will happen on each and every line item, as this is all driven by the Iterator. How can we force the remaining steps to run only when the iteration has completed and all bundles have been processed?
We can find the clue by looking at the output for the Iterator module. Here’s the details for a previous run of this scenario. Note the last two lines: “Bundle order position” and “Total number of bundles”.
“Total number of bundles” is the total number of Line Items in the array. The “Bundle order position” increments for each array line item that the Iterator processes.
So all we need to do is to set a filter on the link before the Google Drive Download a File a module that only proceeds if the Bundle Order Position is the same as the Total Number of Bundles:
You could tidy up this scenario to make the Picking List more nicely formatted, or even to make a copy of a template Sheet first and then update that. But I’ll leave that as an exercise for the reader!
At Four Furlongs we have experience of creating complex Integromat scenarios for Shopify, Xero, Salesforce, Zoho, Knack, Google apps, Office 365 and many more. If you’d like a quote for building your scenario, please get in touch!