Get Action Name(dymamic not harded write) at a string variable

How to write the current Action Name(dymamic not harded write) at Connection String Application Name parameter
I need to fill at my connection string variable the Application Name parameter with the current step name.
I try it but no luck
Application Name=#{OctopusParameters[Octopus.Step.Name]};’

Maybe it will give you idea on how to solve your issue?

Hi Tania,

Thanks for getting in touch! It looks like to grab this step name system variable here, the syntax would just need to be tweaked to match Octopus’ variable substitution syntax. i.e. #{Octopus.Step.Name}. The $OctopusParameters["Octopus.Step.Name"] syntax (with the $) is for use in PowerShell scripts to pass Octopus variables to your script as a parameter.

Does modifying this #{Octopus.Step.Name} syntax instead get this working as needed?

Let me know how you go, or if you have any further questions. :slight_smile:

Best regards,

Kenny

Please check my print, I just use your suggestion #{OctopusParameters[Octopus.Step.Name]} that not work for me.

Hi Tania,

Thanks for following up! Instead of #{OctopusParameters[Octopus.Step.Name]}, try just #{Octopus.Step.Name}. Using your above example, it will end up looking like this:

Application Name=#{Octopus.Step.Name};’

Let me know how you go!

Best regards,

Kenny

Ok, I will try and give you in touch!
Thanks

Don’t work fine…because get the main step not the specific
For example when Adminstration step run the output was Application Name=Deploy Sites;’
but still wrong I need Adminstration the step that is inside Deploy Sites

Any suggestion?

Hi Tania,

Thanks for following up! Sorry for some confusion here. There’s a little difference with parent steps and child steps, where instead of Octopus.Step.Name which will only return the name of a parent step, you can use Octopus.Action.Name instead. That’ll return the child step name, i.e. Administration in your example.

Let me know how that goes. :slight_smile:

Best regards,

Kenny