- 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-16-2017 07:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:56 AM
What is your expected output? Are you relying on PowerShell to just give you artifacts since I don't see any specific output? You may want to build a specific output object to set expections.
Are you able to see your "Write-Host" lines in your MID server log?
I'm sure I've seen this kind of error when an expected object attribute is not set as it should be. When you are building your $NewListIem object, are all of the attributes being populated?
For troubleshooting purposes, I would add more Write-Host lines in between each of the $NewListItem lines to output what each line is set to. Then watch the MID server log while it is running to verify that output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 08:02 AM
Thank you for your quick response Chad. I am very new at this. The output I expect is a numeric value of 200 which means success. That is atleast how it works when the script is run manually.
I will follow your suggestion and see if I can dig in further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 09:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 11:52 AM
Are you able to login to your MID server? If so, go to the agent folder, open the logs folder and open the agent0.log file. Then search for <powershell>. You should find a run of your script and any output, including your Write-Host output.
If you are not able to access your MID server, you can get the log from inside your Instance. Go to MID Server > Servers, select the MID server you are working with, then click the Grab MID Logs related link. Give it a minute to return the log from the server. It comes back as an XML file, and probably pretty long, but you should still be able to search it.
If you still don't see your Write-Host output, your script may not be reaching them for some reason.