When you create a custom form, you can add elements where the user selects a value from a search results list. Using the value picker, the user selects a single value. Using the multi value picker, the user selects one or more values.

The value picker and multi value picker work with the Reference Type that is defined on the custom form Appearance tab. The Reference type is a vRealize Orchestrator resource. For example, AD:UserGroup or VC:Datastore. By defining the reference type, when the user enters a search string, the results are limited to the resources that have the matching parameter.

For the pickers, you can then further limit the possible values by configuring an external source.

Working with the Value Picker

The value picker appears in the form as a search option when users request the item in the catalog. The user enters a string and the picker provides list based on how you configured it.

Value picker in the request form with the list, the single selection dialog box, and the example of the selected value in the form.

You can use the picker based on the following use cases. The most valuable use of the value picker is pairing it with an external source value.

  • Value picker with a constant value source.

    Use this method when you want the requesting user to select from a predefined static list of values. Similar to the combobox, drop down, multiselect, and radio group elements, this method provides search results in a list based on the defined constant values and labels.

  • Value picker with no defined value source.

    Use this method when you want the requesting user to search the vRealize Orchestrator inventory for a specific object with the configured reference type. For example, the reference type is VC:Datastore and you want the users to select the datastore from the retrieved list.

  • Value picker with an external value source.

    Use this method when you want the requesting user to select from results that are based on a vRealize Orchestrator action. For a value picker based on an external source, the action must return a properties array, not a sting array. The following script provides an example of a basic vRealize Orchestrator action that works with the value picker.

    var res = [];
    res.push(new Properties({id: 'id1',label: 'label1'}));
    res.push(new Properties({id: 'id2',label: 'label2'}));
    res.push(new Properties ({id: 'id3',label: 'label3'}));
    return res;

Working with the Multi Value Picker

The multi value picker appears in the request form as a search option, similar to the value picker, but where you can select one or more values. The user enters a string and the picker provides list based on how you configured the element properties.

Multi value picker in the request form with the list, the multiple selection dialog box, and the example of the selected values in the form.

You can use the multi value picker based on the following use cases in addition to the use cases described for the value picker. The most valuable use of the multi value picker is using it with a reference data type and a vRealize Orchestrator reference.

  • Multi value picker with a complex data type and constant value source.

    Use this method when you want the requesting user to select one or more values from a predefined static list of values. Similar to the data grid, this method provides search results in a list based on the defined constant values and labels.

  • Multi value picker with a complex data type and an external source.

    Use this method when you want the requesting user to select one or more values from a list of values based on a vRealize Orchestrator action. You can use this method with vRealize Orchestrator composite types.

  • Multi value picker with a reference data type and a vRealize Orchestrator reference type. Use this method when you want the requesting user to search the vRealize Orchestrator inventory for a specific object with the configured reference type. For example, the reference type is VC:Datastore and you want the users to select the datastore from the retrieved list. Or, if you have a workflow filter configured, you can use Workflow as the reference. To be retrieved, the filter must return values in a property array, not a string array. An example of a workflow filter is provided in the next section. In this example, the filtering is done in the UI when the user enters a search term.
  • Multi value picker with a reference data type, a vRealize Orchestrator reference type, and an external source.

    Use this method when you want the requesting user to select from results that are first filtered by the reference type and then based on a vRealize Orchestrator action. This combination more thoroughly refines the results and populates the request form more quickly. Just as the reference type results must return a property array, so must the external source action. In this example, the filtering is done in vRealize Orchestrator and might improve the speed with which the list is populated, particularly if you have a large number of vRealize Orchestrator actions.

Limit the vRealize Orchestrator results for a multi value picker element results list

To limit the number of actions returned when the user searches for an action, you can create a filter action and bind the filter results to the search term.

  1. In vRealize Orchestrator, create an action named filterWorkflow.
    1. Select Library > Actions, and click New Action.
    2. On the General tab, enter or select the following values.
      Option Value
      Name filterWorkflow
      Module com.vmware.library.workflow
    3. Click the Script tab and add the following script.
      var workflows = System.getModule("com.vmware.library.workflow").getAllWorkflows();
      
      var result = [];
      
      for(var i = 0; i < workflows.length; i++) {
          if(workflows[i].name.indexOf(searchTerm) !== -1) {
              result.push(workflows[i]);
          }
      }
      
      return result;
      
    4. Configure the following properties.
      Screenshot of the vRealize Orchestrator action with the sample script from the previous step and the property configuration provided in this step.
      Properties Option Value
      Return type Enter Workflow and select Array.

      You can use any of the returned types when you run the search. The selected reference type in the custom form must match it.

      If this procedure, continue to use Workflow.

      Inputs Enter searchTerm.

      Notice that the input searchTerm matches the string used in the script.

    5. Click Create.
  2. Configure the multi value picker properties in the custom form designer in Service Broker.
    Composite screenshot showing the Reference data type and Workflow reference type with the Values tab. The Values tab shows the External Source with the action and the field binding.
    1. In Service Broker, select Content and Policies > Content and click the vertical dots to the left of the template that you are modifying and click Customize form.
    2. Add or select the multi value picker element in the design canvas.
    3. In the Properties pane, click Appearance and configure the following values.
      Property Value
      Data type Reference
      Reference type Enter Workflow.

      Remember, this value is the return type selected for the filterWorkflow action in vRealize Orchestrator, and it must be an array.

      Display type Multi Value Picker
    4. Click the Values tab and configure the following values.
      Property Value
      Value options > Value source External source
      Select action Select the filter action. In this example, select filterWorkflows.
      Action inputs searchTerm Select Field and Search term.
  3. Test the filter by requesting the catalog item.

    You must ensure that the filter returns the expected values in the multi value picker list, and that the catalog item deploys correctly.