Best answer

How to determine number of Tasks used for Zaps with Loops

  • 13 December 2020
  • 8 replies
  • 709 views

Userlevel 1
Badge

I don’t seem to understand how to calculate the number of Tasks (I know, it probably is a recurring topic), thanks for pointing me in the right direction:

I have a Zap that gets a single trigger and then plays. Step 6 is a Webhook GET request that seems to return a JSON array. I want the Zap to perform actions for each element of the array. 

For Step 7, the input for the action is that output returned by Step 6 (element i of JSON array), so I assume all following Steps including this one will play as many times as there are elements in the array (returned by Step 6).

But that’s not what I seem to see in the task history: As expected, the Zap runs as many times as there are elements inthe Array provided by Step 6, however, the number of Tasks is the total number of Steps in the Zap for each run.

That doesn’t make sense to me...Wouldn’t it make sense, if steps up to the Steps that take the array as input are counted only once?
 

Is the Zap actually playing ALL Steps (also the ones BEFORE the Webhook GET request) multiple times, or is this just how Zapier displays Task history for Zaps that have a looping element?

icon

Best answer by Troy Tessalone 13 December 2020, 19:45

View original

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

8 replies

Userlevel 7
Badge +14

Articlehttps://zapier.com/help/manage/tasks/learn-about-tasks-in-zapier

Tasks are counted as successfully completed actions in a Zap.

Thus each Action step in a Zap would be counted as 1 Task.

 

Please provide screenshots of your Zap steps and Zap Task History Details for us to better understand how your Zap is structured and executing.

Userlevel 1
Badge

Hi there @Troy Tessalone. I know the general idea, but i’m specifically asking for Zaps containing a Loop, as described above. Not sure a screenshot is able to provide more information but let me try to explain it visually.

The entire Zap

 

In Zap preview this doesn’t work, as it only shows one element of the JSON array, but that’s what one element looks like, however the following steps are supposed to be repeated for each element, yet Steps 1-9 are counted towards the task usage…

 

 

Task history

This is what confuses me: In this instance, Webhook GET in Step 6 gets an array with two elements, and this is what the task history shows:

 

Why is it 2 times 9 tasks? I would expect once 9 tasks, and once just the run from step 6 onwards...Why would a Webhook GET that gets an array trigger the WHOLE Zap? Why does this Zap run two times?

Userlevel 7
Badge +14

Based on the timestamps in the screenshot the Zap triggered twice at the same time.

Take a look at the DATA OUT from the trigger to better understand the differences in the returned data points.

The best way to understand what the Zap did is to look at the DATA IN/OUT for each Step of the Zap in the Zap Task History Details.

 

 

Userlevel 1
Badge

Well, that’s my point: It just doesn’t make sense that the Zap gets triggeretd twice, and also it doesn’t look like it actually is: Everything is exactly identical, Trigger, Data In, Data Out, UP TO STEP 6 (I didn’t compare all steps). Only then I get differences, which is exactly as intended, as the Loop starts with step 6...So it seems we’re back to my original question, or what am I missing here?

Trigger: Identical:

 

It just doesn’t seem to make sense. In both task histories the Webhook request in step 4 are exactly identical. That is fine, as it also didn’t actually call the webhook twice and it shouldn’t, but in that case how can Task history show this and why am I charged twice?

 

Only from step 6 there is a difference in the task history (see “target”):

 

I still am confused. Thanks for your support!

 

This post has been edited by a moderator to remove sensitive information. Please remember to obfuscate any personal information as this is a public forum. 

Userlevel 7
Badge +14

I suggest submitting a support ticket so Zapier can investigate further: https://zapier.com/help

 

Userlevel 1
Badge

I suggest submitting a support ticket so Zapier can investigate further: https://zapier.com/help

 

Ok, thanks, shall do!

Userlevel 1
Badge

So I am still having issues. The gist of the answer via support ticket has been “Zapier does not *really* support this kind of looping/forking. It is just a workaround” which I don’t find particularly satisfying. 

Can someone from the Community and or from Zapier clarify: What is the actual and expected behavior of Zapier when looping Zaps based on arrays (specifically with respect to the number of tasks counted)?

The “Using JavaScript code in Zaps” (https://zapier.com/help/create/code-webhooks/use-javascript-code-in-zaps) states:

Setting the output to an array of objects will run the subsequent steps multiple times, once for each object in the array. [emphasis added]

 

However it seems to me (see above) that Zapier counts all PREVIOUS Steps as well towards the task count. It seems all previous tasks are counted for each loop. I must be wrong since this would be very weird. But can someone clarify?

Userlevel 7
Badge +14

@David@Zapwise

Got this response from Zapier Support about using the (BETA) Looping by Zapier action in Zaps...

 

Due to current limitations in how we display Zap Runs, each Loop iteration is shown as individual Zap Run which can be confusing.

Because Loop iterations are displayed as separate Runs, the Task Usage in Zap History can be incorrectly reported for these Zaps.
Tasks before the Loop Starts will be counted once per Run in Zap History, even though they only consume 1 Task per Trigger.
The Loop step itself also only consumes 1 Task.
We plan to make further updates to Zap History via which should mitigate this.
We do note that in the meantime, Billing will be accurate.