Email templating sorting steps

Hi,

I’m trying to print in the email body the deployment steps using the following code snippet

    #{each step in Octopus.Step}
  • Step: #{step.Number} - #{step.Name}
    Status: #{step.Status.Code}
  • #{/each}

but the steps are randomly sorted

Deployment Steps:
• Step: 1 - IIS AppPool - Stop
Status: Succeeded
• Step: 2 - Deploy Marketplace to IIS
Status: Succeeded
• Step: 3 - Send Deployment Result
Status: Running
• Step: 0 - Acquire Packages
Status: Succeeded
• Step: 4 - Apply Tentacle Retention Policy
Status: Succeeded

How can I sort the steps?
Thank you!

Hi @fabman08,

Thank you for contacting Octopus Support. I’m sorry that you are running into this issue.

Can you tell me what version of Octopus you are currently running?

I look forward to hearing back from you and getting this resolved.

Regards,
Donny

Hi @donny.bell,

actually we are running 2019.13.7

Thank you!

Hi @fabman08,

Thank you for the quick reply.

I had a quick look through our bugs and didn’t find anything. Let me spin up a test environment and see if I can reproduce this issue.

By chance, did you ever add steps or re-arrange your process steps for this project?

Regards,
Donny

Hi @donny.bell,

I’ve simply add steps in the right order.
I’m using “Send an Email” task and the code snippet is placed in the Body area.

Thank you!

1 Like

Hi @fabman08,

Thank you for clarifying that for me.

I was able to reproduce the issue. It looks like a possible bug. I’ll get with my engineering team to confirm.

Once I hear back from them, I’ll let you know. :slight_smile:

Regards,
Donny

Thank you @donny.bell, I look forward to your reply

Hi @fabman08,

Thank you for your patience,

Engineering did confirm this is a bug. I’m currently working on piecing together a workaround for you.

Once I have it figured out I’ll share it with you :slight_smile:

Regards,
Donny

Hi @fabman08,

Good news! The team and I were able to get a workaround going for you. See below:

#{each step in Octopus.Step}#{if step.Number == "0"}
Step: #{step.Number} - #{step.Name}<br>
Status: #{step.Status.Code}<br><br>
#{/if}
#{/each}
#{each step in Octopus.Step}#{if step.Number != "0"}
Step: #{step.Number} - #{step.Name}<br>
Status: #{step.Status.Code}<br><br>
#{/if}
#{/each}

Let me know if this does the trick for you.

Regards,
Donny