vCO Workflow Script to Get the Current Value of a Custom Property
var arrvCACVirtualMachine; arrvCACVirtualMachine = Server.findAllForType("vCAC:VirtualMachine", "VMUniqueID eq '" + objVCVirtualMachine.config.instanceUuid + "'"); var objvCACVirtualMachine; objvCACVirtualMachine = arrvCACVirtualMachine[0]; var objvCACEntity; objvCACEntity = objvCACVirtualMachine.getEntity(); var objvCACHost; objvCACHost = Server.findForType("vCAC:VCACHost", objvCACEntity.hostId); var arrVCACEntityProperties; arrVCACEntityProperties = objvCACEntity.getLink(objvCACHost, "VirtualMachineProperties"); var strReturnValue; strReturnValue = ""; for ( var i = 0; i < arrVCACEntityProperties.length; i++ ) { var objVCACEntityProperties; objVCACEntityProperties = arrVCACEntityProperties[i]; var strPropertyName; strPropertyName = objVCACEntityProperties.getProperty("PropertyName"); var strPropertyValue; strPropertyValue = objVCACEntityProperties.getProperty("PropertyValue"); if ( strPropertyName == strServiceName ) { strReturnValue = strPropertyValue; break; } } return strReturnValue;