N
Novu3mo ago
Onkar

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
Onkar
OnkarOP3mo ago
@Pawan Jain Any support here? This is critical for us as we are doing email customisation based on org.id
Novu_Bot
Novu_Bot3mo ago
@Onkar, you just advanced to level 1!
Pawan Jain
Pawan Jain3mo ago
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
Onkar
OnkarOP3mo ago
@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.
Pawan Jain
Pawan Jain3mo ago
@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
Onkar
OnkarOP3mo ago
@Pawan Jain In that case we have to handle this in the code before sending to novu. That will not be scalable
Pawan Jain
Pawan Jain3mo ago
Sharing the feedback with the team
Onkar
OnkarOP3mo ago
Thanks.

Did you find this page helpful?