- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2015 06:18 AM
Hi,
How can I get parameter from PowerShell and store it in Workflow.Scratchpad
I can do the reverse, like
$fullUrl = '${workflow.scratchpad.inputurl}';
but
${workflow.scratchpad.inputurl} = $powerShellvariable; \
fails.
Can anyone please tell me the right way?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2015 08:01 PM
Hey Kenny!
Thanks for your response.
I already sorted that as follow:
For passing multiple parameters from PowerShell to Service Now, use the following syntax:
Write-Output "%%out_data1%%"
Write-Output "$($fullUrl)"
Write-Output "%%"
Here "out_data1" tag is the one which Service Now will use to read the variables.
$fullUrl is the parameter you want to return to Service Now.
You can have multiple return output blocks anywhere in your PowerShell script.
For example if you wana pass 2 parameters ($fullUrl and $baseUrl )from PS to Service Now, you will write something like this:
Write-Output "%%out_data1%%"
Write-Output "$($fullUrl)"
Write-Output "%%"
Write-Output "%%out_data2%%"
Write-Output "$($baseUrl)"
Write-Output "%%"
Service Now will read these parameters using tags.fullUrl or tags.baseUrl in the Sensor script portion of PowerShell Activity.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2015 02:27 PM
Hi, Mallikarjun.
In the Sensor script portion of the run powershell script activity, type the following to get what you need:
workflow.scratchpad.inputurl = trim(activity.output);
This is assuming of course that the output of the command in powershell is the inputurl.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2015 08:01 PM
Hey Kenny!
Thanks for your response.
I already sorted that as follow:
For passing multiple parameters from PowerShell to Service Now, use the following syntax:
Write-Output "%%out_data1%%"
Write-Output "$($fullUrl)"
Write-Output "%%"
Here "out_data1" tag is the one which Service Now will use to read the variables.
$fullUrl is the parameter you want to return to Service Now.
You can have multiple return output blocks anywhere in your PowerShell script.
For example if you wana pass 2 parameters ($fullUrl and $baseUrl )from PS to Service Now, you will write something like this:
Write-Output "%%out_data1%%"
Write-Output "$($fullUrl)"
Write-Output "%%"
Write-Output "%%out_data2%%"
Write-Output "$($baseUrl)"
Write-Output "%%"
Service Now will read these parameters using tags.fullUrl or tags.baseUrl in the Sensor script portion of PowerShell Activity.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 10:09 PM
Can I have overview of this action.
SInce I have an requirement to execute powershell script in servicenow