Dealing with XML Inputs From Service Manager
In the previous post I showed how we can use the user input field from a service request which contains all the responses that a user enters into the request offering in the self service portal. But now that this information is available how do we consume it in Orchestrator.
There are 2 ways – use the built in Query XML activity or use a Run .NET Script activity.
This is the XML contained in the user input from the service request activity
<UserInputs>
<UserInput Question="First Name" Answer="Anthony" Type="string" />
<UserInput Question="Last Name" Answer="Watherston" Type="string" />
<UserInput Question="Age" Answer="34" Type="string" />
<UserInput Question="Sample Boolean" Answer="true" Type="bool" />
</UserInputs>
Query XML
You pass in the user input from the databus – then use an XPath filter to get the property / attribute you are interested in.
Run .NET Script
Using the Query XML is good for a one off XML answer but if you need to retrieve all of them and output then use a .NET Script activity. The script looks like this – if it had input from a previous activity I would put the link to the published data in there. It is important to cast the $XMLInput variable as XML otherwise it will not work.
Each of the variables is published in the Run .NET Script activity.