i am trying to retrieve vcloud director host system admin user reference for using this user for performing automation tasks.
But resultset is not retrievable with below code. Is there any other way to retrieve Sys Admin User reference?
var expressionUser = new VclExpression(VclQueryAdminUserField.NAME, host.getUsername(), VclExpressionType.EQUALS);
var filter = new VclFilter(expressionUser);
var params = new VclQueryParams();
params.setFilter(filter);
var users = new Array();
var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINUSER, params);
while (resultSet != null) {
var records = resultSet.getRecords(new VclQueryResultAdminUserRecord());
System.log(records.length + " Admin User record found");
for each (var record in records) {
var userRef = new VclReference();
System.log(record.href + " href");
System.log(record.name + " name");
System.log(record.type + " type");
userRef.href = record.href;
userRef.name = record.name;
userRef.type = record.type;
users.push(host.getEntityByReference(VclFinderType.USER, userRef));
}
resultSet = resultSet.getNextPage();
}
I have tested your code and it works perfectly for me on 5.1.
How is configured your vCloud plug-in ? is it set to system org ? Is the user system org admin ?
Christophe.
Thank you. It was found to be a configuration issue in the environment.