If-Else Step Condition
I’m currently exploring ways to define workflows from dashboard and would like to understand how to add conditional (if/else) steps.
Specifically, I want to achieve something like this:
If payload.org.id === "123" → send Email A
Else → send Email B
8 Replies
@Pawan Jain Any support here? This is critical for us as we are doing email customisation based on org.id
@Onkar, you just advanced to level 1!
Hi Onkar
Apologies for delay in response on this Step conditions can be used for this usecase
https://docs.novu.co/platform/workflow/step-conditions
You will need to create two email steps and add condition, based on that condition, either of those steps will be used to send email
Apologies for delay in response on this Step conditions can be used for this usecase
https://docs.novu.co/platform/workflow/step-conditions
You will need to create two email steps and add condition, based on that condition, either of those steps will be used to send email
@Pawan Jain I couldn't find anything related to handling the "else" part. I have three email steps:
* Step 1 is triggered when
org.id == 123
* Step 2 is triggered when org.id == 567
* If neither of these conditions are met, I want Step 3 to run by default.
So essentially, Step 3 should act as a fallback without needing a specific condition—only if the previous steps don’t match.@Onkar
Thanks for sharing the usecase. Currently, we don't support branching (representation of if else in UI).
I would recommend sending org.id=-1 and using this for third fallback condition
@Pawan Jain In that case we have to handle this in the code before sending to novu. That will not be scalable
Sharing the feedback with the team
Thanks.