Variable within a variable. Dynamic step names

Hi. I have an email template that grabs output variables from a previous step. It works fine when I hard code the step name in the ouput variable.

#{if Octopus.Action[MyStep].Output.MyVar}

But that means that anyone that uses the template need to have their previous step always called “MyStep.” What if they wanted a different one? Is there a way to have the “MyStep” bit to be dynamic, maybe passed in as a parameter?

To experiment, I’ve tried both
#{unless Octopus.Action[#{StepVariable}].Output.MyVar}
#{unless Octopus.Action[{StepVariable}].Output.MyVar}

but no luck.

Hi, I had a somehow related issue described here:

I end-up doing some work-around which I posted there too. Maybe it will give you idea on how to solve your issue?

Hi Daniel,

Thanks for getting in touch! Thanks for the workaround suggestion Arnaud! I did however, have a chat with one of our developers, they informed me that in Octopus version 3.3.27 we implemented the method that you attempted Daniel.

If you were to upgrade to Octopus version 3.3.27 and try with #{unless Octopus.Action[#{StepVariable}].Output.MyVar} again it should work fine. :slight_smile:

Looking forward to hearing how you go with this.


Great! Thanks Arnaud. I was going to look into your suggestion today but it sounds like it’s worth holding fire for now. We were waiting on 3.4 before upgrading as we need webdeploy v3.6 and we’re currently running on a customised calamari. Is there any indication, or a rough idea, of when a stable 3.4 might be released? Otherwise I’ll see about upgrading to .27 and rebuild another custom calamari.

Hi Daniel,

Thanks for getting back! Octopus version 3.4 is scheduled to be released by the end of this month. It’s not far off now. :slight_smile:


That’s great news! Thanks. I think we might hold off till it’s ready then.


This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.