I thought this code in a simple workflow (passing a valid vcdHost) would list all the OrgVDCs in my vCloud Director that I can see in the plugin tree.
var queryService = vcdHost.toAdminObject().getAdminQueryService();
var expression = new VclExpression(VclQueryOrgVdcField.NAME, "*", VclExpressionType.EQUALS);
var filter = new VclFilter(expression);
var params = new VclQueryParams();
params.setFilter(filter);
var resultSet = queryService.queryOrgVdcRecords(params);
while (resultSet != null) {
var records = resultSet.getRecords();
System.log(records.length + " records found");
for (i=0; i < records.length; i++) {
System.log(records[i].name);
System.log(records[i].id);
}
resultSet = resultSet.getNextPage();
}
However, it does not, telling me instead that there are "0 records found". I know for certain there are two OrgVDCs visible both via the plugin and via the vCloud Director WebUI.
Any pointers/guidance as to what I am missing?