Question

How can I abort / Fork a Zap using Code for Zapier?

  • 14 January 2021
  • 2 replies
  • 735 views

Userlevel 1
Badge

In this post it is explained that stopping a Zap using Code by Zapier is possible by adding a Filter step that references a variable that gets set in the Code step. So far so good.

However: To be more efficient, isn’t there a way to do this directly with Code? I suppose not. That’s a bummer.

My issue is related but the following: I have a Zap that triggers various secondary Zaps and each Zap is only running if it fulfills certain criteria (via a Filter step). It would be more efficient and probably less confusing to actually do the filtering/triggering in the primary Zap in the a Code step itself and specifically trigger the Zaps that are needed. Do you guys know of an example of this somewhere?

Currently, my Task history is full with Zaps that get filtered directly after the Trigger, which isn’t too bad, but doesn’t look nice.


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

2 replies

Userlevel 7
Badge +12

@David@Zapwise 

I was just discussing this with a colleague today! A rather janky solution but you could create a custom dummy app integration that acts merely as a code block which would allow you to throw the halt error to stop the zap from running. https://platform.zapier.com/cli_docs/docs#halting-execution 

I would further second what Troy stated in regards to your issue. Your code block could fire off webhooks to trigger the other zaps as needed. 

Userlevel 7
Badge +14

You can make API calls via a Code step: https://zapier.com/help/create/code-webhooks/javascript-code-examples-in-zaps#step-7