Hello,
I have been using the following discussion as a reference to query a vCloud vApp object from vCO using a name string.
http://communities.vmware.com/thread/391401
My code looks like:
var queryService = vcloudServer.getQueryService()
var expression = new VclExpression(VclQueryVAppField.NAME, vAppName, VclExpressionType.EQUALS);
var filter = new VclFilter(expression);
var params = new VclQueryParams();
params.setFilter(filter);
var vApp = new Array();
var resultSet = queryService.queryRecords(VclQueryRecordType.VAPP, params);
while (resultSet != null) {
var records = resultSet.getRecords(new VclQueryResultVAppRecord());
System.log(records.length + " records found");
for each (var record in records) {
if (record.vdc == vdc.getReference().href) {
var vAppRef = new VclReference();
vAppRef.href = record.href;
vAppRef.name = record.name;
vAppRef.type = record.type;
vAppRef.push(vdc.getHost().getEntityByReference(VclEntityType.VAPP, vAppRef));
}
}
resultSet = resultSet.getNextPage();
}
System.log("vApp(s) found:"+vApp.length)
Where vcloudServer is of the type vCloud:Host and vAppName is the name of the vApp I am looking for (string type).
The workflow runs but it never finds anything.
Any clue what is the problem here?
(vCO 5.1, vCloud director 5.1)
Thanks,
Juan.