Is there any way to get an organization or VDC from inside a workflow using only the name?
I've found actions to get Org from vApp or media, but not by just using the name.
I want to update a VDC, and I need to pass the name and organization to the workflow via the Soap API, and i guess I need to know the VDC or Organization ID as input to the Update VDC workflow.
Any ideas on how to accomplish this? I have Organization name and the VDC name.
Check my post in this thread for an example using the query service:
http://communities.vmware.com/message/2136092#2136092 <- this example returns all vDCs in an array ... I'll find the other example that does a get by name...
Yes, but you need to specify the vcloud-host, too.
You can try this:
var host = VclHostManager.getHostbyUrl("Your host URL");
//get Organization by bame
var myOrg;
for each (var org in host.getOrganizations())
{
if(org.name == "Your Org name")
{
myOrg = org;
break;
}
}
//get vDC by name
var myOrg;
for each ( var vdc in myOrg.getVdcs())
{
if (vdc.name == "Your vDC name")
{
myVdc = vdc;
break;
}
}
But in big environments it's better to use the query service.
Regards
Thomas
Check my post in this thread for an example using the query service:
http://communities.vmware.com/message/2136092#2136092 <- this example returns all vDCs in an array ... I'll find the other example that does a get by name...
Yes, here it is: http://communities.vmware.com/message/2132742#2132742
Thx everyone for your input, Burkes first post worked with some minor tweaks (just return one VDC instead of an array).