You can create a generic Automation Orchestrator action to be used in custom forms to populate external values.

In this scenario, you want the ability to return a list of suitable tags for placement based on an input of tag key.

Having the tag key as an action makes this action reusable regardless of the tag you must return. In this case, you authenticate with VMware Aria Automation by using a REST host stored in a configuration element. You then make a call to find all suitable tags matching the supplied tag key.

These tag keys and values are pushed into an array to return the values for our drop-down menu. This action returns an array of strings containing the filtered tags.

The getTagByKey action below is included in the samples.

var url = "/iaas/api/tags" 
var parameters = encodeURI("$filter=key eq " + tagKey); 

var tags = System.getModule("com.vmware.vra.extensibility.plugin.rest").getObjects(vraHost, 
url, parameters); 

var tagArray = new Array(); 
for each (var tag in tags) { 
  tagArray.push(tag.key + ":" + tag.value); 
} 
  
return tagArray;