Last active
March 25, 2017 01:24
-
-
Save trisharia/fd3519fb4b6e3952f9eff6882d30fdbf to your computer and use it in GitHub Desktop.
Get the ID of the Catalog Request of a vRA VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VMware vRealize Orchestrator action sample | |
// | |
// Get the ID of the Catalog Request for a vRA IaaS VM | |
// | |
// For vRO/VRA 7.0+ | |
// | |
// Action Inputs: | |
// host - vCAC:VCACHost - vRA IaaS Host | |
// virtualMachine - vCAC:VirtualMachine - vRA IaaS VM | |
// | |
// Return type: string - the ID of the Catalog Request of a VM | |
var vmEntity = System.getModule("com.vmware.library.vcac").getVirtualMachineEntity(host,virtualMachine); | |
var requestId = getVmEntityPropertyValue(host, vmEntity, "__Cafe.Root.Request.Id"); | |
return requestId; | |
function getVmEntityPropertyValue(host, vmEntity, propertyName) { | |
var virtualMachinePropertiesEntities = vmEntity.getLink(host, "VirtualMachineProperties"); | |
for each (var virtualMachinePropertiesEntity in virtualMachinePropertiesEntities) { | |
if (virtualMachinePropertiesEntity.getProperty("PropertyName") == propertyName) { | |
return virtualMachinePropertiesEntity.getProperty("PropertyValue"); | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment