- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 03:17 PM
Hello,
I am trying to run a PowerShell script through a custom PowerShell activity in SN. When I test the inputs, I get the following output "Cannot bind argument to parameter 'String' because it is null.". No hresult and no errorMessages.
Can anyone suggest what this would mean and how can I resolve this?
Thanks,
~T
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2017 08:09 AM
Everything looks fine in the log, in so much as PowerShell is running and reporting correctly. I think that one/all of your object attributes is not being set correctly. How are you reading inputs in your PS code? I see that you are passing variables to the function, such as $password and $title, but I don't see where you are importing them from your workflow. Maybe I'm missing something, but you would need to include something like this:
Your custom activity has inputs called "password" and title. To get those into PowerShell, you need:
$password = $env:SNC_password
$title = $env:SNC_title
You could also do:
addListItem -password $env:SNC_password -title $env:SNC_title
The inputs in the activity are treated like environment variables and SNC_<variable_name> is how they are referenced in PowerShell. Without this part, none of your object attributes would be populated and it would return the error you see.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 12:25 AM
Have you tested the script out of ServiceNow. Does it work manually. It seems that some argument is missing within the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 01:20 AM
Hi,
Yes, manually the script works perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:14 AM
chadlockwood - Can you suggest? your blog on PowerShell custom activity was very helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:16 AM
Do you have the contents of the script.