Email template

I was looking to expand on the email template mentioned here : http://docs.octopusdeploy.com/display/OD/Email+notifications

I wanted to include the status of each action (success, skipped, etc…) but those do not seem to be available in the email step, is this correct?

Hi Alex,

Thanks for getting in touch! I have run the following on my testing VM with success. However I did have to add if statements, as we do not fill the error data if there is no error.

So my email template:

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}
#{if Octopus.Step[OctoFX Services].Status.ErrorDetail}#{Octopus.Step[OctoFX Services].Status.ErrorDetail}#{/if}

OctoFX Trading Website Status:
#{if Octopus.Step[OctoFX Trading Website].Status.Code}#{Octopus.Step[OctoFX Trading Website].Status.Code}#{/if}
#{if Octopus.Step[OctoFX Trading Website].Status.Error}#{Octopus.Step[OctoFX Trading Website].Status.Error}#{/if}
#{if Octopus.Step[OctoFX Trading Website].Status.ErrorDetail}#{Octopus.Step[OctoFX Trading Website].Status.ErrorDetail}#{/if}

And the output in my email:

OctoFX Database Status:
Succeeded

OctoFx Services Status:
Succeeded

OctoFX Trading Website Status:
Succeeded

Hope this helps, or please let me know extra details of what you were trying to get working.
Vanessa

What about skipped steps?

Also, I was wondering about actions. The documentation mentions an IsSkipped property on an action, are there other properties? like IsFailed?

I created a test project. It has 3 steps.

Test1 : a powershell script that just does a write-host
Test2 : a powershell script that just does a write-host
Success Email : an email step with the following template

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

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

When I get the email, the body of the email is this :

Test1 Status: #{if Octopus.Step[Test1].Status.Code}#{Octopus.Step[Test1].Status.Code}#{/if} Test2 Status: #{if Octopus.Step[Test2].Status.Code}#{Octopus.Step[Test2].Status.Code}#{/if}

FYI, we are using version 2.4.9.167 .

Odd…if I add the following to the template

    #{each action in Octopus.Action}
  • #{action.Name}
  • #{/each}

My email now looks like this :

Test1 Status:
Test2 Status:
• Test1
• Test2
• Success Email

Nevermind, after reading the Octopus changelog, I don’t think the version of Octopus we are using has those variables.