We are looking to publish a workflow in ARS that will allow a user to input a parameter. The parameter would be a ServiceNow RITM number. We would like to pass that parameter to a powershell script inside the workflow. In the script we will query a log file using the RITM number.
Is this possible?
I see posts about going the other way, using scripts to set parameters in a workflow, like this one:
"Script format for defining Workflow parameter value"
When you create a notification in a workflow, you can modify the notification message and reference the parameters and include them in the message with this
Workflow.ParameterValue["Password"]
I'm looking for the equivalent of that for inside of a script.
I have tried:
function onInit($context)
{
$param = $workflow.Parameter("TestParam")
$param2 = $context.Parameter("Password")
#Workflow.ParameterValue["Password"]
}
And this
function onPreCreate($Request)
{
$strClass = $Request.Class
if ($strClass -eq "user") {
$strPass = [string]$Context.Parameter("Password")
$strPass | Out-File '\\ServerName\c$\param2.txt'
}
}
Wanted to specific this would be for a "on user demand workflow"