When you customize a vRealize Automation Service Broker request form, you can base the behavior of some fields on the results of a vRealize Orchestrator action.

There are several ways that you can use vRealize Orchestrator actions. You might have an action that pulls the data from a third source, or you can use a script that defines the size and cost.

The first example is based on manually added fields so that you understand the underlying process. The second example, uses the same premise, but instead relies on a blueprint field.

In addition to the following examples, other examples are available in the VMware Cloud Management blog.

Size and cost as manually added fields example

In this use case, you want the catalog user to select a virtual machine size, and then display the cost of that machine per day. To do this example, you have a vRealize Orchestrator script that correlates the size and cost. You then add a size field and a cost field to the blueprint custom form. The size field determines the value that appears in the cost field.

  1. In vRealize Orchestrator, configure an action named getWindows10Cost.
    Example of a vRealize Orchestrator Action with Size and Cost
  2. Add a script.

    You can use the following example script.

    var cost = "Unknown";
    
    switch(deploymentSize) {
    	case 'small' : cost = "$15";break;
    	case 'medium' : cost = "$25";break;
    	case 'large' : cost = "$45";break ;
    	
    	default : break ;
    }
    
    return cost;
  3. Add deploymentSize as an input string.
  4. In vRealize Automation Service Broker, add and configure a Size field to a blueprint custom form.

    Configure the size field as drop-down element with Small, Medium, and Large values.

    On the Values tab, configure the following property values.

    • Default value = Large
    • Value options
      • Value source = Constant
      • Value definition = small|Small,medium|Medium,large|Large
  5. Add the cost field as a text field to display the cost as defined in the vRealize Orchestrator action based on the value selected in the size field.

    On the Values tab, configure the following property values.

    • Default value = External source
    • Select action = <your vRealize Orchestrator actions folder>/getWindows10Cost
    • Action inputs
      • deploymentSize. This value was configured in the action as the input.
      • Field
      • Size. This is the field that you previously created
  6. Enable the custom form and save it.
  7. To verify that it is working, request the item in the catalog. You should see the Cost field populated based on the selected Size value.
    Populated example in the catalog

Cost based on schema element example

In this use case, you want the catalog user to see the cost of that machine per day based on the flavor property in the blueprint. To do this example, you use the vRealize Orchestratorscript from the previous example. But in this use case the cost is based on the flavor size that your user selected in the custom form when they request the vRealize Automation Service Broker catalog item.

The simple example blueprint includes a size input field where the user selects the flavor property.
Example of inputs for flavor mapping in the blueprint
The custom form uses the field, named Select machine size in this example.
Value options in the custom form designer
The cost deploymentSize input is based on the Select machine size field. SCREENSHOT
Cost based on the schema size field in the catalog request