Unable to use system variables

Hi Octopus Team,

When I use a script module with only one function then I can retrieve the value of system variable.
However if I use a script module that consists of multiple functions, then I CAN NOT retrieve the value of system variable.

In a deployment step, I call a function GetReleaseNumber

if I include a script module only has GetReleaseNumber function, then “#{Octopus.Release.Number}” will return the value of the current release number.

if I include a script module that has multiple functions in it, one of the functions named GetReleaseNumber, then “#{Octopus.Release.Number}” will return no value or “#{Octopus.Release.Number}”.

Please help.



Hi Jian,

Thanks for reaching out. Could you send me a Script module example so we can reproduce this on my end? Also please let me know which version of Octopus you are running.


Hi Dalmiro,

I am just trying to use this system variable to get the current release number #{Octopus.Release.Number}.

One script module has only one function which included that system variable, works fine.
Another script module has multiple functions, and one of the functions has this system variable, but it is returning the value as “#{Octopus.Release.Number}”.

The Octopus Server version is 3.3.20. Octopus Tentacle is 3.4.15x64.



#{Octopus.Release.Number} is not the right way to reference an Octopus variable from Powershell. You need to use it like $OctopusParameters['Octopus.Release.Number']. So a function on a script module that uses the variable would look like

function GetReleaseNumber()
    Write-Output $OctopusParameters['Octopus.Release.Number']

Let me know how that goes.

Hi Dalmiro,

That helps, it is strange how would it work in the first place if I used it in a wrong way.
Thanks for the help.