Enthusiast
Enthusiast

VRA 8.2 - Value Picker with External Source

Has anyone had any luck with populating a Value Picker form item with an externa vRO action?  The docs say that the action has to return a Properties array, but my action that returns a Properties array does not show up as an option as an external source for a value picker (no actions seem to show up actually) 

We have some fairly large dropdowns and I think the value picker could be a better experience for our users, but I'm not having any luck so far.  I'm also not entirely sure if it is meant to be used with just a list of custom options or if we always have to choose sort of reference type?  The wording is a bit confusing in the docs, but the example seems to indicate the former.

0 Kudos
2 Replies
Hot Shot
Hot Shot

I got stuck earlier: I added a value picker with reference type AD:User to search for a domain user. How can I use the selected username as a request input? Is there some sort of mapping to regular string inputs?

0 Kudos
Enthusiast
Enthusiast

I banged my head on the wall for a while on something like this.

In our case, we want to allow the user to pick (one more more) AD Users via lookup on the form and add them to a list that is passed into the deployment.

We would then take these users and add them to an AD Group that we dynamically create with the blueprint (custom resource of type AD:UserGroup) and assign them as members to the group upon deployment.

Using a combination of custom resources on the blueprint (Custom.ADAdminGroup) and we pass the list of users from the input array to the vRO workflow that does the creation of the custom resource.

 

Blueprint inputs would be an array of objects, with external type AD:User.  This will allow you to have a dataGrid on the custom form, and when you add a row, you get a lookup field that will find your AD User:

 

 

inputs:
  adminGroupMembersUsers:
    type: array
    items:
      type: object
      title: AD Users for Admin Group
      $data: 'vro/data/inventory/AD:User'
      properties:
        id:
          type: string
        type:
          type: string

 

 

 

 In the resources, we add an instance of our Custom.ADAdminGroup to the canvas.  It takes multiple inputs, like the OU (we dynamically set this based on inputs as well, but I won't go into that here..) The key here, is we stringify the array of objects (AD:User) to json.  This is then a string input on the vRO workflow:

 

 

  AD_Admin_Group:
     type: Custom.ADAdminGroup
    dependsOn:
      - Cloud_machine
     properties:
      ou: '${input.admingroupOU}'
      name: '${resource.Cloud_machine.vmHostname+''_LocalAdmin''}'
      adminUsers: '${to_json(input.adminGroupMembersUsers)}'

 

 

 

The vRO workflow that we wrote for the create of custom object "Custom.ADAdminGroup" will take in that json string of users (which has everything we need..) we parse the string, do a lookup by the user ID, and add the AD:User object to an array.

 

 

adUserListJSON = JSON.parse(adminUsers);

try {
  var adUser = Server.findForType("AD:User",adminUserID);
  System.log("Found AD user ["+adUser.name+"] ... Adding to list for membership add.");
  adUserList.push(adUser);
  } catch (e) {
    System.error(e);
  }
}

 

 

Once we have our list of AD:Users, then it's basically standard vRO workflows for creating AD group, add members, etc.

Working really well for us so far.  The nice thing about this, is that when we destroy the deployment, we also clean up