Define a relationship so that the value of a parent property determines the child property values that are available in a drop-down list.

In this example, a new VirtualMachine.Network.Environment property filters available network options based on the machine environment. The VirtualMachine.Network.Environment property acts as a filter for the networks that a user can select when confirming a machine request. An associated child property, VirtualMachine.Network0.Name, is also created and a relationship is formed between the two properties. The user must first select the environment before selecting from the list of networks that are applicable to the selected environment.

Table 1. Relationship Between VirtualMachine.Network.Environment Property and VirtualMachine.Network0.Name Property Menu Options

Values for the VirtualMachine.Network.Environment Property (parent)

Values for the VirtualMachine.Network0.Name Property (child)

Development

Development Network

Test

Test Network 1 Test Network 2

Production

Production Network Failover Network

Workflow Overview

You use the following workflow to create the relationship and add the properties to the blueprint.

  1. Create the parent and child property definitions.

  2. Add a Relationship attribute to the child property whose value is the name of the parent property.

  3. Create a value expression that describes which values to display in the child drop-down list for each value of the parent property.

  4. Add the value expression as an attribute of the child property.

  5. Add both properties to a blueprint or property group.

The following example is a logical progression from the following topics.

Instead of specifying a ValueList attribute for the child property, you can use an XML string in a ValueExpression attribute to specify the mapping between the values of the parent property and the possible values of the child property.

This example uses the ValueList, ValueExpression, and Relationship property attributes with the DropDownList property definition control type.

Example Procedure

  1. Log in to vRealize Automation as a tenant administrator.

  2. Select Administration > Property Dictionary > Property Definitions.

  3. Create the parent property.

    1. Click the Add icon on the Property Definitions page.

    2. Enter VirtualMachine.Network.Environment in the ID text box.

    3. Enter Environment in the Label text box.

    4. Select a data type from the Data type drop-down menu.

    5. Enter a description that describes the intent of the property and any information that might help the consumer best use the property.

    6. Do not select the Multiple Values checkmark option.

    7. Select Dropdown from the Display Advice drop-down menu.

    8. Click Save.

  4. Define the values for the parent property.

    1. In the VirtualMachine.Network.Environment property name row, click Edit in the Property Attributes column.

    2. Click New Property Attribute.

    3. Select ValueList from the Type drop-down menu.

    4. Enter Values in the Name text box.

    5. Enter Development,Test,Production in the Value text box.

    6. Click Save.

    7. Click OK.

  5. Create the child property.

    1. Click New Property Definition on the Property Dictionary page.

    2. Enter VirtualMachine.Network0.Name in the Name text box.

    3. Enter Select Network in the Display Name text box.

    4. Select DropDownList from the Control Type drop-down menu.

    5. Click Save.

  6. Define the relationship between the child and parent properties.

    1. In the VirtualMachine.Network0.Name property name row, click Edit in the Property Attributes column.

    2. Click New Property Attribute.

    3. Select Relationship from the Type drop-down menu.

    4. Enter Parent in the Name text box.

    5. Enter VirtualMachine.Network.Environment in the Value text box.

    6. Click Save and click OK.

  7. In an XML editor, create the following value expression, which specifies the values of the child property based on the values of the parent property, and save it as an XML file:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <ArrayOfPropertyValue xmlns:xsi=
    	"http://www.w3.org/2001/XMLSchema-instance">
    <PropertyValue>
    		<FilterName>VirtualMachine.Network.Environment</FilterName>
    		<FilterValue>Development</FilterValue>
    		  <Value>Development Network</Value>
    	</PropertyValue>
    	<PropertyValue>
    		<FilterName>VirtualMachine.Network.Environment</FilterName>
    		<FilterValue>Test</FilterValue>
    		  <Value>Test Network 1</Value>
    	</PropertyValue>
    	<PropertyValue>
    		<FilterName>VirtualMachine.Network.Environment</FilterName>
    		<FilterValue>Test</FilterValue>
    		  <Value>Test Network 2</Value>
    	</PropertyValue>
    	<PropertyValue>
    		<FilterName>VirtualMachine.Network.Environment</FilterName>
    		<FilterValue>Production</FilterValue>
    		  <Value>Production Network</Value>
    	</PropertyValue>
    	<PropertyValue>
    		<FilterName>VirtualMachine.Network.Environment</FilterName>
    		<FilterValue>Production</FilterValue>
    		  <Value>Failover Network</Value>
    	</PropertyValue>
    </ArrayOfPropertyValue>
  8. Add the value expression, specifically the XML file content, that you just created to the child property.

    1. In a text editor, format the value expression so that it is a single line string with no line breaks.

    2. In the VirtualMachine.Network0.Name property name row, click Edit in the Property Attributes column.

    3. Click New Property Attribute.

    4. Select ValueExpression from the Type drop-down menu.

    5. Enter Expression in the Name text box.

    6. Copy the value expression from the text editor and paste it into the Value text box.

    7. Click Save and click OK.

  9. Add both properties to a blueprint.

    1. Create a new blueprint or edit an existing blueprint.

    2. Click the Properties tab on the blueprint page.

    3. Click New Property.

    4. Enter VirtualMachine.Network.Environment in the Name text box. This name must be an exact character match for the property name you created for the parent property in this example.

    5. Leave the Value text box blank.

  10. Select the Prompt User check box.

  11. Click OK.

  12. Click New Property.

  13. Enter VirtualMachine.Network0.Name in the Name text box.

  14. Click OK.

When a user uses this blueprint to request a machine, the Environment and Select Network drop-down menus now appear on the Confirm Machine Request page and are initially empty. The user can select an environment, which then narrows the list of networks that they can select for the machine that they are requesting.