Cancel/stop 下一个 "Action" 来自 Zapier 的代码触发
Cancel/stop next "Action" from triggering in Code by Zapier
我想做的事情很简单,如果满足某个条件,就用一些数据继续下一个动作。如果没有,就停止。
根据文档,您所要做的只是return一个空数组。
If Code by Zapier is the Zap's trigger and you return an empty array
[], we will not trigger any actions downstream — it is as if you said
"nevermind" in code.
问题是我正在这样做,但 "downstream" 操作仍在触发并且它抛出错误,因为它显然没有所需的数据。
if (clients[inputData.email]) {
return {
name: inputData.name,
courseName: inputData.courseName,
price: inputData.price / 100,
plan: inputData.plan,
email: clients[inputData.email],
};
}
return [];
啊!所以事实证明这是按预期工作的。根据您在上面发布的文档(也可以找到 here),强调我的:
If Code by Zapier is the Zap's trigger and you return an empty array [], we will not trigger any actions downstream — it is as if you said "nevermind" in code.
由于您的代码是一个动作,因此下游步骤始终是 运行,除非有明确的错误。处理此问题的最佳方法是使用过滤器。我会用一个过滤器步骤跟进您现有的代码,该过滤器步骤仅在 name
(或其他始终存在的东西)存在时才继续。
抱歉让您感到困惑!我可能会在文档中加粗或以其他方式强调该行。
我想做的事情很简单,如果满足某个条件,就用一些数据继续下一个动作。如果没有,就停止。
根据文档,您所要做的只是return一个空数组。
If Code by Zapier is the Zap's trigger and you return an empty array [], we will not trigger any actions downstream — it is as if you said "nevermind" in code.
问题是我正在这样做,但 "downstream" 操作仍在触发并且它抛出错误,因为它显然没有所需的数据。
if (clients[inputData.email]) {
return {
name: inputData.name,
courseName: inputData.courseName,
price: inputData.price / 100,
plan: inputData.plan,
email: clients[inputData.email],
};
}
return [];
啊!所以事实证明这是按预期工作的。根据您在上面发布的文档(也可以找到 here),强调我的:
If Code by Zapier is the Zap's trigger and you return an empty array [], we will not trigger any actions downstream — it is as if you said "nevermind" in code.
由于您的代码是一个动作,因此下游步骤始终是 运行,除非有明确的错误。处理此问题的最佳方法是使用过滤器。我会用一个过滤器步骤跟进您现有的代码,该过滤器步骤仅在 name
(或其他始终存在的东西)存在时才继续。
抱歉让您感到困惑!我可能会在文档中加粗或以其他方式强调该行。