Parameter values from step template doesn't resolve

Hi team,

we are on 3.11.11 octopus version. We started having issues with template steps where we have parameters defined.

I was playing today to figure out what is happening, why suddenly our restart computer template stopped working and it seems, the second parameters for MinorReason variable is not getting passed to the script. I checked that by write-output to pull the values. It gets pulled just for MajorReason variable.

Also before 3.11.11 version ,if i would pass - write-output “#{variableNameFromParametersInStepTemplate}” it would show the value when running the script. Now it just throws the variable name.

Also, my main concern, where does the MinorReason value disappears, if in template parameters window it is showing both of them, but in my script it doesnt pass to my variable or to write-output and my script doesnt work.

See attached screen shots

Hi,

Thanks for getting in touch! I’m sorry you’ve run into this roadblock with your step template. There are two ways to get your variables to resolve to your variable value.

First, you can use the syntax $OctopusParameters["VariableName"]
Second, you can use the syntax like you’re calling a PowerShell variable directly, i.e. $VariableName

I’ve set up a test using these different syntaxes in my local instance to illustrate this and the results from them. I’ve followed your example and set up the parameters as you’ve shown in your detailed screenshots (thanks for that by the way, that really helps!) The first screenshot shows my script, and the second shows the resulting task log from running it.

As to why the syntax worked before you upgraded to 3.11.11, I’m not quite sure. Which version of Octopus did you upgrade from? I’ll be happy to look into it further if it helps.

I hope this helps! Don’t hesitate to reach out if you have any further questions.

Best regards,

Kenny

Cheers Kenneth, all good! :wink:

Hi,

That’s not a problem! I hope it helped get you going!

Don’t hesitate to reach out if you have any further questions at all. :slight_smile:

Kenny