I'm working on a XaaS catalog item that will allow users to change Memory and CPU for vms. I have them select the VM they want from a form field that is VC:VirtualMachine so they can't dork it up and put in something that doesn't exist. Is there a way to populate a dropdown that sets the default value with the current memory and cpu for that vm? I don't see a way to bind the VC:VirtualMachine field to another field.
Thanks
You could create actions in vRO that will accept the VC:VirtualMachine as a parameter and which extract the relevant fields for display. I suspect you'd need to be careful about translation from number --> String but what you want to do should be doable without too much trouble
In my opinion the better way is to accomplish this operation from vRA deployments as a Day2 action. The Day2 is useable at VM Resource in the deployment, so you can easily retrieve the vcUUID of the vCenter VM.
Then you can update both VC:VirtualMachine object and vRA deployment to match.
I can share more if needed.
Please do share more if you don't mind.
To use a VM within a deployment, you need to onboard it which is not what you may want.
I'd rather go with the action approach eoinbyrne suggested.
Are you sure you don't want to use native Day2 action that update CPU and RAM ?
But if you want to retrieve a VC:VM from a vRA VM Resource during a Day2 action execution is to retrieve a property that is not well named providerId
vmInstanceId = System.getContext().getParameter("__metadata_resourceProperties").providerId;
System.log("VM Instance ID: " + vmInstanceId);
Once you get this ID you can retrieve the VC:VirtualMachine with this method
var vm = VcPlugin.getAllVirtualMachines(null, "xpath:instanceId='" + vmInstanceId + "'")[0];
System.log("Virtual Machine Found : " + vm);
In your case, if you need to access this ID directly from Day2 action form you have to map the same attribute in the Custom Form editor. This ID can be passed to another input of the Day2 worfklow and retrieve a property of this VM.
So sorry I can't add images in my message, don't know why.