Change VM name upon creation
Let's develop a workflow with the following specification:
INPUT: vCloud:VM object
Process:
- Rename VM
- Change Guest OS Name
Create a new workflow
Add a workflow element

- Add workflow Library > vCloud Director > vApp > VM > Rename VM
Setup parameters
- Make sure the workflow element is selected, Click the Setup... button
- Select Value for newName parameter
- Click the Promote button
Add workflow element

- Add workflow Library > vCloud Director > vApp > VM > Guest Customization > Change computer name
Setup parameters
- Make sure the workflow element is selected, Click the Setup... button
- Select newName from the dropdown list for the second parameter
- Select Local variable for the Output Parameter vmOut
- Click the Promote button
Add Scripting
- Bind the attribute newName as OUT (not shown)
- Enter the following code: (to generate a new name for the machine)
newName = "myvm" + Math.floor(Math.random() * 999);
- Click the Save and close button
Create a new notification subscription
Configure a notification subscription

- Navigate to vCloud Director Notifications > Configuration > Create a vCloud Director notification subscription
- Click the Start Workflow... button



Start subscription listener


Testing
Login to tenant T1

- Launch Chrome in incognito mode
- Select the bookmark vCloud Director > Site A - Tenant T1 - H5 UI
- Enter credentials
user: t1admin
password: VMware1! - Click the LOGIN button
Search a vApp Template

- Click the menu button
- Select Libraries
- Select vApp Templates
Create vApp
- Click on the 3 dots menu for vApp Template tc-linux
- Select Create vApp
Configure Networking
- Select T1-OrgNet-Rtd for the network connected to NIC 0 of the vm linux-base
- Click the NEXT button
Find the vApp

- Click the menu button
- Select Datacenters
- Click the organization vDC T1-OVDC
Find the VM name

- Select vApps
- Click the DETAILS menu for the vApp test-vapp-naming