Question

How to force the iterations of Looping by Zapier to follow a specific sequence?

  • 17 August 2023
  • 5 replies
  • 679 views

Userlevel 1
Badge

Is it possible to set up a looping action in such a way that the looping of all the items does not happen asynchronously (in parallel) and without pausing each iteration with a whole minute in between each loop? My understanding is that this is one purpose that the Delay by Zapier app is meant for when using the “Delay after queue” event. However, there is a minimum value of “1 whole minute” for the time delay. That is unacceptable for my purpose.

Crazy that this has to be a minimum of 1 whole minute when the world of code actions happens in milliseconds.

How can I set it up in such a way that the Looping by Zapier app follows a predetermined sequence (for simplicity’s sake, let’s just say “follows the sequence of the line item’s index number within the line item group”), and each of the loop’s iterations wait in queue to be triggered, not until their previous iteration first completes its loop?

Ideally, sequence could be defined by any input value, but at the very least, have a synchronous option that follows the index of the array’s items.

I’m a no-code geek who is starting to mature into the world of “low code.” And there’s no way my technical requirement here is unorthodox. 

I’m pretty comfortable with webhooks, paths, sub-Zaps (and getting comfortable with Storage and Code by Zapier, working with JSON/Javascript) etc. in case there are any routes to take in either of those directions.

 

As an added curious question: Even if I settle for using the expected asynchronous behavior of the Looping by Zapier app, is it always guaranteed that the last iteration in the loop will wait for all other iterations to first be complete?

I have a filter at the end of my loop that says “only continue if [this line item’s value for] loopIterationIsLast = TRUE” in order to log a summary of everything so far (capture all the actions from all the loop’s iterations).

Trying to use this as a way to “do something after a loop.”

In my experience, this has worked as desired. But to my surprise, if I have examples of my “resulting summary” where ‘iteration 3 out of 5’ was the last one to get printed… suggesting that the last iteration (‘iteration 5 out of 5’) completed its “journey” (including passing the filter logic that all other iterations would get blocked by) before some other iterations completed theirs. How then, was ‘iteration 5 out of 5’ able to capture data, from the post-filter steps, that didn’t yet exist (understanding that all of this stuff happens in a weird world of milliseconds)?

Used this loop_iteration value...
… and mapped it to this output. You can see that the last iteration did not “print” last.

Does this suggest that in my latest example, when there is a filter within a loop that gates everything except for the last iteration, it somehow naturally stages a queue for all other things to happen in parallel before proceeding with actions after the filter? I’m assuming not...

Do I ever run the risk of my post-filter ‘summary logging’ steps missing data from some of the loop’s other iterations because these post-filter steps starting to do their thing for the last iteration before such other loop iterations were completed? If there is some risk of this happening, then, functionally, what is even the point of the Looping by Zapier app producing attribute values for the iterations such as “Loop Iteration Is Last”?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 7
Badge +14

Hi @Woo at SpotOn 

Good question.

You can add a Delay step.

Related topic:

 

Userlevel 1
Badge

Hi @Woo at SpotOn 

Good question.

You can add a Delay step.

Related topic:

 

@Troy Tessalone I appreciate the speedy response, so no offense, but I went through a lot of effort to articulate my awareness of that suggestion and why the 1 minute minimum delay is not sufficient. Not only is it not good enough for my needs, but I feel pretty confident in saying that this would be insufficient for many programming/automation use cases (not ignoring that this 1-minute-minimum-delay-in-Zapier’s-implementation-of-handling-loops may be “just good enough” for other users who have posted).

The second half of my post that also brings up a pretty technical question about the backend nature of how some of these mechanisms work was, might I say, very thoughtful and pointed. I would love a more thoughtful response from the community if one is available. I can be patient for a post that offers me a deep understanding of this topic, correction, and/or clarification for me then being able to map out solutions in most appropriate and efficient way on this platform.

Altogether, I still do appreciate your response. I just should have made it more obvious that I’d already seen that article. I’ve updated my post accordingly. (edit: Never mind, I didn’t realize “edit” is only for forum “replies,” and it’s not possible to edit the initial post itself)

Userlevel 7
Badge +14

@Woo at SpotOn 

Here’s a related topic that the Delay minimum can be set to less than 1 minute.

 

The key is to make sure that each iteration is incrementally longer than the one before so they process in order.

 

Otherwise, you can create a looping Zap with Webhooks that will process in order ASAP as per this example:

 

Userlevel 7
Badge +14

@Woo at SpotOn 

When the Looping app first came out, I submitted a feature request for a control that enables sequential processing, as I a saw the need for the same functionality.

(Needless to say, it’s been a while and still waiting on that improvement.)

 

Challenges with sequential processing…

 

there can be Paths after a Looping step.

Zap Runs can proceed down multiple Paths when Filter conditions are met.

 

Also, what if 1 loop encounters an error in a step?

What should happen to the remaining loop iterations?

  • Should the remaining loop iterations halt?
  • Should the remaining loop iterations proceed to process?
Userlevel 7
Badge +14

@Woo at SpotOn 

If you have feedback and feature requests those can be submitted via a ticket to Zapier Support to be logged: https://zapier.com/app/get-help