Email Template

We are using version 2.5.7.384. I’m trying the email template in the documentation:

<h3>Task summary</h3>
<ol>
#{each step in Octopus.Step}
  <li>#{step.Name | HtmlEscape} &mdash; <strong>#{step.Status.Code}</strong> #{step.Status.Error | HtmlEscape}
  #{if step.Status.ErrorDetail}
    <pre>#{step.Status.ErrorDetail | HtmlEscape}</pre>
  #{/if}
  </li>
#{/each}
</ol>

but this is my output in the email :

Task summary

  1. Test1 — #{step.Status.Code} #{step.Status.Error | HtmlEscape}
  2. Test2 — #{step.Status.Code} #{step.Status.Error | HtmlEscape}
  3. Sub — #{step.Status.Code} #{step.Status.Error | HtmlEscape}
  4. Success Email — #{step.Status.Code} #{step.Status.Error | HtmlEscape}
  5. #{step.Name | HtmlEscape} — Succeeded #{step.Status.Error | HtmlEscape}
  6. #{step.Name | HtmlEscape} — Succeeded #{step.Status.Error | HtmlEscape}
  7. #{step.Name | HtmlEscape} — Running #{step.Status.Error | HtmlEscape}

Hi Alex,

Thanks for reporting this. Kind of embarrassing when the code example we provide totally doesn’t work.
I was able to 100% recreate this, and I’ve created a ticket on GitHub that you can track here:

I know that calling the steps by name to get their output does work such as:

OctoFX Database Status:
#{if Octopus.Step[OctoFX Database].Status.Code}#{Octopus.Step[OctoFX Database].Status.Code}#{/if}

#{if Octopus.Step[OctoFX Database].Status.Error}#{Octopus.Step[OctoFX Database].Status.Error}#{/if}
#{if Octopus.Step[OctoFX Database].Status.ErrorDetail}#{Octopus.Step[OctoFX Database].Status.ErrorDetail}#{/if}

OctoFx Services Status:
#{if Octopus.Step[OctoFX Services].Status.Code}#{Octopus.Step[OctoFX Services].Status.Code}#{/if}
#{if Octopus.Step[OctoFX Services].Status.Error}#{Octopus.Step[OctoFX Services].Status.Error}#{/if}

Thanks again!
Vanessa

Hi Alex,

We have a bandaid to the code example (fixing the overall problem in 2.6 with the step iteration).

Code:


<h3>Task summary</h3>
<ol>
#{each step in Octopus.Step}
  #{if step.Status.Code}
    <li>#{step | HtmlEscape} &mdash; <strong>#{step.Status.Code}</strong>
    #{if step.Status.Error}
      <pre>#{step.Status.Error | HtmlEscape}</pre>
      <pre>#{step.Status.ErrorDetail | HtmlEscape}</pre>
    #{/if} 
    </li>
  #{/if}
#{/each}
</ol>

Thanks
Vanessa