VMware Cloud Community
frenchtoasters
Contributor
Contributor

VM custom properties

I am trying to get the value of a custom property of a VC:VirtualMachine object in vRO. I have found the syntax to set this value, vm.setCustomValue("name", value) but I cannot seem to find the correct way to get the value of a custom property that has been set. Does anyone know the correct syntax or where I might be able to find that?
0 Kudos
5 Replies
maaca
Enthusiast
Enthusiast

You can get it using:  System.getModule("com.vmware.library.vc.customattribute").getCustomField(VM, "name")

frenchtoasters
Contributor
Contributor

Thanks for the response but that line doesnt seems to be working it gives me the following error:

TypeError: Cannot read property "customFieldsManager" from undefined (Dynamic Script Module name : getCustomField#8)

 

I verified that I can see the attribute in vcenter on the vm just cant seem to get it with vro

0 Kudos
maaca
Enthusiast
Enthusiast

Looks like there is something wrong with your installation. What vSphere and Orchestrator versions are you using? Can you check vRO Configuration (https://vro:8283) if all the plug-ins are installed and loaded?

0 Kudos
frenchtoasters
Contributor
Contributor

vCenter 5.5.0 build 218311 vRO: 5.5.2 build 1946710 all the plugins are installed and say that they are loaded as well.
0 Kudos
maaca
Enthusiast
Enthusiast

Finally, I found way how to reproduce your error.

Make sure that "VM" is only one VcVirtualMachine and not array of VMs.

0 Kudos