Hi All,
I have a customer who wants to trigger a vCO flow from an external source using the vCO REST API. One of the arguments sent to the vCO workflow which will be triggered, is the vCAC Host name.
My question is - since the arguments comes in as String from the REST call, how do I convert it in to a vCAC:vCACHost object so as to be used in a script within my flow.
Thanks.
Your customer can either pass a string representation of the object to the REST API as described in this tutorial.
Otherwise they can pass a string containing the host id and get the matching vCACHost object in the workflow like this:
var vCACHosts = Server.findAllForType("vCACHost");
for each (var vCACHost in vCACHosts) {
if (vCACHosts.id==histId) {
var matchingHost = vCACHosts;
break;
}
}
If there were a lot of hosts then I would recommend using the entityManager to filter by ID and then converting the entities back to object with the getInventoryObject() method as described in this article.
1 problem, 3 solutions
Your customer can either pass a string representation of the object to the REST API as described in this tutorial.
Otherwise they can pass a string containing the host id and get the matching vCACHost object in the workflow like this:
var vCACHosts = Server.findAllForType("vCACHost");
for each (var vCACHost in vCACHosts) {
if (vCACHosts.id==histId) {
var matchingHost = vCACHosts;
break;
}
}
If there were a lot of hosts then I would recommend using the entityManager to filter by ID and then converting the entities back to object with the getInventoryObject() method as described in this article.
1 problem, 3 solutions
Perfect, thanks
Always a good philosophy to have more answers than questions!