I have an action that gets a vCenter VM by id. If i use any attribute of the VM I want to get, other than id, to perform the get it randomly fails. Can anyone tell me if what im doing would cause a failure? Also when i try to use the VM i successfully get via the id when i try to use it later in workflows sometimes it works and sometimes it doesn't. And furthermore it will work in one step but not another. If i take the exact same command, something like System.log(vm.config.hardware.device) and place it multiple times int he same custom script it will work in one step then fail later in the same workflow in the same run... I'm running vRO 5.5.2.
System.log("Trying to resolve a vCenter VM with ID: " + id); var sdkConnections = VcPlugin.allSdkConnections; var vCenterVms = new Array(); for each (var sdkConnection in sdkConnections) { System.log("Searching vCenter: " + sdkConnection.name); vCenterVms = sdkConnection.allVirtualMachines; for each (var vCenterVm in vCenterVms) { if (id == vCenterVm.id) { var found = true; System.log("Found vCenter VM: " + vCenterVm); break; } } if (found == true) { break; } } if (vCenterVm == null) { System.log("No vCenter VM Found"); } else { return vCenterVm; }