Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Problem with moveIntoFolder_Task variable

$
0
0

Hello,

I spend a lot of time already trying to find out how can I put VM which I found into moveIntoFolder_Task.

 

What I'm trying to do:

1. create a folder

2. find a VM provided into text field

3. Move this VM into target folder.

 

 

try {newFolder = parentFolder.createFolder("test1");}

catch(err){}

 

findVM(vmname);

function findVM(vmname) { 

allVms = System.getModule("com.vmware.library.vc.folder").getAllVirtualMachinesByFolder(parentFolder); 

ret = null;  for (var i in allVms) {

if (allVms[i].name == vmname) {  ret = allVms[i];  break;  }  }  return ret;

}



var vms1 = new Array();

//vms1 = [];

vms1 = vms1.push(ret);

 

task = newFolder.moveIntoFolder_Task(vms1);

var actionResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,progress,pollRate) ;


vms1 is it VC:VirtualMachine type- however when I select this variable manually as an attribute - this works fine, I can cmove VM into target folder.

 

When I'm finding this VM by using findVM{} function I'm getting following error:

 

state: 'failed', business state: 'null', exception: 'Cannot convert 1.0 to com.vmware.vmo.plugin.vi4.model.VimManagedEntity[]


Do you know how can I convert VM into VimManagedEntity data type?


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>