This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Modifying Workflow Parameters in a script

Hello,

I'm currently running ARS 6.9 and am trying to understand some basic workflow functionality.

 

For a basic example I have a test workflow like so:

There's a parameter for it aptly named 'TestParam'. This parameter is set as a string that's value is defined by a script:

Next, the script is run, all it does is return a string:

 function onInit ($Request)
{
    $Test = "Hello World"    
    return $Test
}

Lastly, a report to verify the parameter setting from the script:

The end result of this is:

 

 

 

Clearly the parameter is not being set. One thing I noticed is in the script properties, the 'function to declare parameters' option. I've set it to the onInit function but when I open the 'Specify Parameters' box there are no parameters listed:

It's from this I'm presuming I need to set more in the script itself. I have read through the SDK on the $Context object but it states 'internal object "Context" that implements the AddParameter method used to add a new parameter to your policy script'. This suggests creating a brand new parameter in the workflow not modifying an existing one which is where I'm getting a little confused. Anyone able to steer me true on this? I think I'm close I'm just missing a key concept here.

Thanks!

 

Parents
  • Are you more interested in receiving values back FROM your script or sending values TO your script?

    In the latter case, if you setup the parameter in the workflow definition, you can reference it in your script thus:

    # Get an input file name from the workflow

    # Assumes the name 'inputfile' was assigned to the parameter name in the workflow definition

    $InputFileName = $workflow.parameter("InputFile")
Reply
  • Are you more interested in receiving values back FROM your script or sending values TO your script?

    In the latter case, if you setup the parameter in the workflow definition, you can reference it in your script thus:

    # Get an input file name from the workflow

    # Assumes the name 'inputfile' was assigned to the parameter name in the workflow definition

    $InputFileName = $workflow.parameter("InputFile")
Children
No Data