Hi Team,
I’m trying to implement Run Condition for a process step through variable. I’m getting 2 variable from 2 different steps and if any of them is true, step should run.
This is what I’m writing in Run Condition, but its not working.
#{if (Octopus.Action[Step_1].Output.Mail_Flag == “1”) | (Octopus.Action[Step_2].Output.Mail_Flag == “1”)}true#{/if}
Thanks is advance.
Vivek Rai
Hi Vivek,
Thanks for getting in touch! Unfortunately we don’t have any built-in support for this OR
type of syntax, and the |
character is designated as a pipe operator for filtering (more details in our docs). This is still possible, but the syntax doesn’t look super nice. This is the example variable run condition that worked in my local instance.
#{if Octopus.Action[step1].Output.Var1}true#{/if}#{if Octopus.Action[step2].Output.Var2}true#{/if}
This will evaluate to true if either or both Var1
set in step1
or Var2
in step2
evaluate to true and will only evaluate to false if neither have a value of True
. So using your sample I think it would end up looking like this.
#{if Octopus.Action[Step_1].Output.Mail_Flag == “1”}true#{/if}#{if Octopus.Action[Step_2].Output.Mail_Flag == “1”}true#{/if}
I hope this helps, and let me know how you go!
Best regards,
Kenny
1 Like
Thanks Kenneth, for quick response.
I think this will not fulfill my purpose. Actually why I’m looking something like OR operator, because I’m sure out of these 2 conditions, one will return false always.
And at runtime, if any of condition is returning True, my step should be executed.
I hope I’m clear, please let me know if I’m not clear. Thanks
Vivek Rai
Hi Vivek,
Thanks for keeping in touch! I’m sorry that I wasn’t super clear there. The sample I set up and pasted above will execute the step if either of the variables created on the prior steps returns True
, meaning one of them can return false and the run condition will still pass and execute the step. The following is a screenshot of my verbose task log highlighting the output variables created on each step (one True
and one False
) where my third step that has the run condition defined evaluated to True
and ran.
This also evaluated to true if the step1’s variable is True
and step2’s is False
.
Let me know if that helps achieve what you’re after!
Best regards,
Kenny
Thanks Kenneth and apologies for late response.
I was in hurry to deliver so I have created 2 separate step and assign one condition to each, That was fulfilled my requirement that time but I will surely try your suggested option as well. Thanks
Thanks,
Vivek Rai
Hi Vivek,
You’re very welcome, and no worries about the late response. Thanks for keeping in touch, and let me know how you go with the other solution. I’ll be happy to dive back into this one if needed. 
Best regards,
Kenny