Skip to main content

Hi, 

I’m looking at some custom logic with a Code by Zapier step, and it would be convenient if under certain expected conditions, I can just terminate the Zap. I know I can return a value that can then be used in a Filter step but that just seems like an overkill. 

I’ve tried returning `null` (using the Javascript actions) and `process.exit(0)` but both of these result in a Zap error. 

Has anyone found a way to do this more gracefully without a Filter step? 

 

Hi @GeorgiM 

Good question.

A Code step can be the last step in a Zap.

You just have to make sure it returns an output.

Examples: https://help.zapier.com/hc/en-us/articles/8496197098253-JavaScript-code-examples-in-Zaps

 


Thanks @Troy Tessalone.

In my case, the Code step is actually not the last step in the Zap. The step does quite a bit of transformation and conditional logic and in some of the cases it would be convenient that the Zap can just terminate and not proceed with subsequent steps. 


@GeorgiM 

You would need to add a Filter step after the Code step.


@GeorgiM 

Another approach would be to conditionally fire a webhook in the Code step.

That webhook would trigger another Zap.