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 VMware Aria Automation 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.
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 VMware Aria Automation 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 VMware Aria Automation Orchestrator action. The following script provides an example of a basic VMware Aria Automation Orchestrator action that works with the value picker. In this example, the reference type is Properties.
var res = []; res.push(new Properties({label: 'label1',value: 'value1'})); res.push(new Properties({label: 'label2',value: 'value2'})); res.push(new Properties({label: 'label3',value: 'value3'})); return res;
Note: The Properties input cannot be input to a workflow, only an intermediate value in the custom form.
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.
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 VMware Aria Automation 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 VMware Aria Automation Orchestrator action. You can use this method with VMware Aria Automation Orchestrator composite types.
- Multi value picker with a reference data type and a VMware Aria Automation Orchestrator reference type. Use this method when you want the requesting user to search the VMware Aria Automation 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 VMware Aria Automation 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 VMware Aria Automation 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 VMware Aria Automation Orchestrator and might improve the speed with which the list is populated, particularly if you have a large number of VMware Aria Automation Orchestrator actions.
Limit the VMware Aria Automation 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.
- In VMware Aria Automation Orchestrator, create an action named filterWorkflow.
- Select New Action. , and click
- On the General tab, enter or select the following values.
Option Value Name filterWorkflow Module com.vmware.library.workflow - 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;
- Configure the following properties.
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.
- Click Create.
- Configure the multi value picker properties in the custom form designer in Automation Service Broker.
- In Automation Service Broker, select and click the vertical dots to the left of the template that you are modifying and click Customize form.
- Add or select the multi value picker element in the design canvas.
- 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 VMware Aria Automation Orchestrator, and it must be an array.
Display type Multi Value Picker - 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.
- 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.