Hi there, @RichC. Wow, that is a tricky one!
Hmm, perhaps you could use a similar approach to what’s mentioned in this guide:
But have two paths one checking the result of a search action to see if the product already existed (see Search for existing data in Zaps for more details):
- One path would add the product into QuickBooks if it didn’t already exist and then add it to the digest.
- And the other path would add the product that it found to the digest.
Both paths would have a filter after those digest actions that only allows that iteration of the loop to continue running if the Loop Iteration is Last field is true. As we don’t know whether the last product the loop runs through will be an existing product or a new product there would need to be a Release Digest action in both paths - which would only run if that particular path’s rule conditions were matched AND it passed the filter conditions. After the Release Digest actions (in both paths) you’d then have a Create Bill action where you’d take the information from the digest and use it to create the bill. Since only one Path should run for the last loop iteration only one bill would be created.
That said, depending on what’s released from the digest you may also need to use a Formatter (Utilities > Line Itemizer) action to convert the digest items into line-items that you can use in the Create Bill action.
Do you think that approach might work?
If I've misunderstood what you're looking to do or you run into any issues in giving that a try just let me know. Always happy to help further!