VMware Cloud Community
jvm2016
Hot Shot
Hot Shot
Jump to solution

api explorer_vRO

Hi All ,

I am developing a simple workflow to  retrive few properties of virtual machine .

need some help using api explorer built in vRO.

folowing is what i did .

1:create input parameter vmName and bind it to in tab of scriptable task .

2:under scriptable element wrote folowing  javascript code to get name ,state and nics of vm respectively .

can someone help me how to reach to" state property" in apiexplorer  as its giving me undefined result.

pastedImage_2.png

Tags (1)
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I assume vmName is of type VC:VirtualMachine, right?

vmName.guest returns an object of type VcGuestInfo. This type does not have a property named state, and that's why you are getting undefined.

Instead of vmName.guest.state you probably want to use vmName.guest.guestState, as VcGuestInfo has a property named guestState.

View solution in original post

4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I assume vmName is of type VC:VirtualMachine, right?

vmName.guest returns an object of type VcGuestInfo. This type does not have a property named state, and that's why you are getting undefined.

Instead of vmName.guest.state you probably want to use vmName.guest.guestState, as VcGuestInfo has a property named guestState.

jvm2016
Hot Shot
Hot Shot
Jump to solution

Thanks llian ,

yes ,type is VC:VirtualMachine.

and as per your suggestion iam able to find that property .

Thnaks for your help.

also

if you can help me in following.

1:what schema element should i drag so that i can input virtual machine name directly insted of going to vcenter inventory.

below is what i am currently using

pastedImage_0.png

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

So you want to not use inventory browser to find a select the VM, but instead just type the name of the VM? Just go to Presentation tab, and on the vmName input field add property 'Select value as' with value 'list'. After that, when you launch the workflow presentation, it should show a field where you can type some text ang get filtered list of VMs whose name matches the entered text as a substring.

jvm2016
Hot Shot
Hot Shot
Jump to solution

Thank you very much .that worked .

Reply
0 Kudos