I recently needed to figure out how many items are deployed for a specific vRA Business Group. Items include virtual machines but also anything else a user can deploy. That seemed an easy task but finding all items in a business group turned out to be a bit harder than expected.
So to save others the trouble of figuring out how this works I’ll share my code here. You can copy-paste the code below directly to a vRO action.
/*getresources*/
var cafeHost = vCACCAFEEntitiesFinder.getHostForEntity(businessGroup);
service = cafeHost.createCatalogClient().getCatalogConsumerResourceService();
var filter = new Array();
filter[0] = vCACCAFEFilterParam.substringOf(“organization/subTenant/id”, vCACCAFEFilterParam.string(businessGroup.id));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var odataRequest = new vCACCAFEPageOdataRequest(1, 10000, query);
resources = service.getResourcesList(odataRequest);
return resources;