- Question Types
- available since Release 4.4
- BETA Status
To configure PowerShell as a Question Type, configure your Service and choose “PowerShell” as a Type.
In Release 4.5, this feature is in BETA State
- Choose a Script you want to execute. PowerShell Files need to be stored in your PowerShell Script Path.
- Choose “Single” or “Multiple” Selection Type.
Since 4.5, you can transfer Values from the Service to the PowerShell Question Script to work with those Values.
We use the Built-In Initialize Data named “$au2matorhook” and transfer the result from the previous Question and the BuiltIn Data Parameters to this Parameter as JSON.
So, your first lines should be
param ($au2matorhook) $jsondata = $au2matorhook | ConvertFrom-Json
And then $jsondata.**** has your Values stored.
So, for example, if you have a Question with the internal Name “CUser” you can get the Value with “$jsondata.CUser”
If you want to work with the Built-In Value, do it like this
$InitiatedBy=$jsondata.InitiatedBy $Service=$jsondata.Service $TargetUserId=$jsondata.TargetUserId
Make sure your PowerShell Script returns a String so that the Value will be set in the Question as Answer.
If you Return anything else, we try to show the result as a Prepoluated Table, and you can select the Values.
See our GitHub Repo for our PS Templates: