Thomas
Thomas5mo ago

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)...
No description
Jump to solution
3 Replies
Solution
nithinrdy
nithinrdy5mo ago
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)
No description
nithinrdy
nithinrdy5mo ago
And then the cases could have the values to match:
No description
Thomas
ThomasOP5mo ago
@nithinrdy got it! good idea, thanks!