I have this situation.
- User enters coupon in UI and clicks submit button
- Workflow action triggers and it looks up the coupon code.
- It needs to pass the coupon details to a plugin as a parameter.
The problem arises when the coupon code is invalid. In that case “do a search for” returns nothing and the plugin blows up because it says an expected param was not passed to it.
My question is: Can I do an if…else. So if coupon not found in database, I pass 0 to plugin. But if the coupon is found I pass the coupon value to plugin.
Yes. Just add an only when at the bottom of the action to say Search for Coupons first item is not empty. Then duplicate that action and say only when Search for Coupons first item is empty and pass a 0 or some other way of handling it.
You could do what @williamtisdale said and it will work perfectly.
But I don’t like to duplicate workflows because I always forget to update on both places when needed
- add a workflow to get the coupon (“make changes to a thing”, but don’t change anything)
- call the API and send result of step 1 value, but
- you add “result of step 1’s is empty: formatted as text:”
– if yes (is empty): pass 0
– if no (not empty): pass the coupon code
This topic was automatically closed after 70 days. New replies are no longer allowed.