VMware Cloud Community
Eichenbaum
Contributor
Contributor
Jump to solution

Parse actionResult

As example, the following:

actionResult=System.getModule("com.vmware.library.vc.vm.network").getNetworkForGivenNic(vm,nicNumber);

results in:

     DynamicWrapper (Instance) : [VcNetwork]-[class com.vmware.vmo.plugin.vi4.model.VimNetwork] -- VALUE : Network<network-61>'Green'

I only want the string portion for network name; 'Green'. What's the best way to pull this out? I see there is a property 'name' for VcNetwork, but many variations of attempts to reference to this have only produced errors.

Ideas/guidance?

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

You are being returned an object, not a string.. so your code should actually be a little more like this to get the string value for the name of the network:

var network=System.getModule("com.vmware.library.vc.vm.network").getNetworkForGivenNic(vm,nicNumber);

System.log("Network name: "+network.name);

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
1 Reply
Burke-
VMware Employee
VMware Employee
Jump to solution

You are being returned an object, not a string.. so your code should actually be a little more like this to get the string value for the name of the network:

var network=System.getModule("com.vmware.library.vc.vm.network").getNetworkForGivenNic(vm,nicNumber);

System.log("Network name: "+network.name);

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos