ThomasT
BuildShip2y ago
4 replies
Thomas

Switch Node: one case for several conditions

How do I define a case for several conditions? For expression value "type" I want "case 1" to be true for values: "checkout.session.completed", "customer.subscription.created", "customer.subscription.updated"

I tried so far:

["checkout.session.completed", "customer.subscription.created", "customer.subscription.updated"] "checkout.session.completed" || "customer.subscription.created" || "customer.subscription.updated" "checkout.session.completed", "customer.subscription.created", "customer.subscription.updated"
Solution
Hey Thomas, the Switch Node executes the sequence whose case value matches the evaluated expression value, and this check is performed using the strict equality operator.

One thing you could try is evaluating the incoming event in the expression and classifying it as required, see attached image for an example (if the incoming event is present in the array, the condition evaluates to true and case1 is returned as the expression, which is then matched against the cases that follow)
image.png
Was this page helpful?