Home Survey App

Using Orchestrator to automate the results out of Survey APP

Anthony_FautleyAnthony_Fautley Customer IT Monkey ✭
Hi there

I am using Orchestrator to automate the results out of my survey app i can use the get object to get the questions out in JSON format quite easily. However when trying to convert from JSon into a readable out put i'm getting a issue...

Here is a simple JSon from the question of one of my results.

[{"Question":"Are you happy with your resolution?","Answer":5,"Type":"satisfaction","List":[],"Id":"c0ab96b0-bfad-49c1-bc35-7e58c64449c4","Optional":false},{"Question":"How well did the resolution meet your request","Answer":"9","Type":"list","List":["10","9","8","7","6","5","4","3","2","1"],"Id":"7a9a91db-8e6a-42d9-9006-59c1f1137e08","Optional":false},{"Question":"Any Comments","Answer":"TEST","Type":"textarea","List":[],"Id":"c0b490a1-3767-46cb-8594-3b59e6bb2af3","Optional":true}]


I'm using that with the powershell script below.

$Questions = '{"Questions": [{"Question":"Are you happy with your resolution?","Answer":5,"Type":"satisfaction","List":[],"Id":"c0ab96b0-bfad-49c1-bc35-7e58c64449c4","Optional":false},{"Question":"How well did the resolution meet your request","Answer":"9","Type":"list","List":["10","9","8","7","6","5","4","3","2","1"],"Id":"7a9a91db-8e6a-42d9-9006-59c1f1137e08","Optional":false},{"Question":"Any Comments","Answer":"TEST","Type":"textarea","List":[],"Id":"c0b490a1-3767-46cb-8594-3b59e6bb2af3","Optional":true}]}'

$survey = ConvertFrom-Json -InputObject $questions

$answer = $survey.Questions | Select-Object -Property Answer -First 1 | ft -HideTableHeaders
$answer

When i run this powershell in a normal powershell window i get the result i'm looking for  Which is "5"

However when i run it in a run.net script in Orchestrator i get the following message 

Microsoft.PowerShell.Commands.Internal.Format.GroupEndData

I've figured out that the Highlighted bit below is returning something i would not expect..

$survey = ConvertFrom-Json -InputObject $questions
is returning 

@{Questions=System.Object[]}

I should be getting 
@{Question=Are you happy with your resolution?; Answer=5; Type=satisfaction; List=System.Object[]; Id=c0ab96b0-bfad-49c1-bc35-7e58c64449c4; Optional=False},

This is looking like why i cannot automate the results out of the JSON.  

Any ideas why?  I have checked the powershell version and changed the registry so it is using the latest powershell. 


Sign In or Register to comment.