Variables in email

Hi, I’m trying to modify an email code sample that you provided on your website (http://docs.octopusdeploy.com/display/OD/Email+notifications) and make it a little bit more readable or eloquent, however I can’t find any way to get the result I am looking for because I can’t get it to resolve the “step” variable in the each loop.

#{each step in Octopus.Step}
#{Octopus.Action[StaticData].isSkipped}
#{Octopus.Action[step].isSkipped}
#{Octopus.Action[step.Name].isSkipped}
#{Octopus.Action[{step}].isSkipped}
#{Octopus.Action[{step.Name}].isSkipped}
#{Octopus.Action[#{step}].isSkipped}
#{Octopus.Action[#{step.Name}].isSkipped}
#{/each}

Is there any way to resolve a variable inside another variable in emails like what I’m trying to do above?
Also, what’s the difference between Action and Step? Is it simply a granularity thing? (Action may contain multiple steps?)
And why isn’t there a step.isSkipped?

Thanks,

Complete code for reference:

Task summary

    #{each step in Octopus.Step} #{if step.Status.Code} #{if step.Status.Error}
  1. #{step | HtmlEscape} — #{step.Status.Code}
    #{step.Status.Error | HtmlEscape}
    #{step.Status.ErrorDetail | HtmlEscape}
    #{/if} #{unless step.Status.Error} #{if Octopus.Action[step].isSkipped}
  2. #{step | HtmlEscape} — #{step.Status.Code} #{/if} #{unless Octopus.Action[step].isSkipped}
  3. #{step | HtmlEscape} — #{step.Status.Code} #{/unless} #{/unless}
  4. #{/if} #{/each}

Hi Robert,

Thanks for getting in touch! Action vs Step is actually the other way around.
The step is the wrapper around an action. If it is a singular step, they are the same.
If however the step is a parent step, then the step is the wrapper around multiple actions.

It looks like you will have to have to separate sections.
Octopus.Action does not record Errors against it, and Octopus.Step does not record if its skipped (a step cant technically be skipped because it’s a wrapper).
You also can’t inside a variable use a variable in email templates.
The below works to show what was skipped.

#{each action in Octopus.Action}
  #{if Action.IsSkipped} the step  #{action.Name} was skipped#{/if}
 #{/each}

Hope that helps!
Vanessa

Hi Vanessa,

I realised it was the other way around after posting, but couldn’t edit it. :frowning:
Thanks for the time and the clear explanation. Sad to see we can’t “nest” variables in emails. You still have a great product…

Thanks again,

Robert