vRealize Automation 7 Property Dictionary Relationship


In the past I have documented how to do vCloud Automation 6.x Property Dictionay and Property Dictionary relationship in a post that was well recieved and got quite popular which can be found at: vCAC 6 Property Dictionary Relationship. I have meant to do the same for vRA 7 Property Dictionary Relationship for sometime as it has dramatically changed from it’s 6.x days, but I had pushed it forward several times and finally got the time to get around it.

In this post, I am going to show you how to populate a dropdown menu created in vRA property dictionary from a vRO workflow. Further, I will show you how to filter it based on another dropdown as well. This is get very useful when you have two related dropdown in your vRealize Automation Request forum and would like to filter one of them based on the other dropdown selection.  It help you ensure only valid values are showing in the second dropdown menu making your request form more user friendly. Further, this same process can be used to populate the dropdown list from an external source like MS SQL or so on.

Before you start with this exercise, I would highly recommend you go through my past post to get an understanding of the terms used in this post: vCAC Custom Properties – Build Profiles(Renamed Property Groups in vRA 7.0) – Property Dictionary

The two drop menus I am dealing with in this examples are:

  • Drop Down Name: Environment.  Values: Development, QA, Non-production, production
  • Drop Down Name Workload typ(ResPolicyID)e. Values: Production, Development.   <== This one will be utilizing the __reserrvationPolicyID custom property. Please refer to my vCAC Property dictionary post referred to earlier for more info on that.

Below screenshot shows what the end result looks like.

vRA 7 two drop downs in a property dictionary relationship

The Goal of this exercise that if the user on the first dropdown choose Development or Non-Production, only the Development option will be available in the Workload Type(ResPolicyID) Drop Down. Where if he choose Production or QA in the Environment Drop Down, he will be only presented by the Production option in the Workload Type(ResPolicyID) Drop Down. This is a very simple use case, but it will simplify explaining how this work.

Let’s start by creating the Parent Property Definitions by going to Administration => Property Dictionary => Property Definitions.

Fill the Property Definition as in the below screenshot.

Create the Parent Custom Property definition

vRA 7.x utilizes vRO Actions for establishing a relationship between property dictionary dropdowns. Let’s start by first creating the vRO Action required for this. I have created a package for you to use in this exercise. You can download it here:vRO vRA PropertyDictionaryRelationship Action download.  To get it into your vRO follow the below steps:

1- Open the vRealize Orchestrator Client.

2- Shift to Design mode

3- Go to the Actions tab

4- Right Click and hit “New Module” to create a new module and name it “com.vmware.vt.PropertyDictionaryRelationship”

5- Right click the newly created module “com.vmware.vt.PropertyDictionaryRelationship”, and choose import action.

6- Browse to the earlier downloaded action  and hit open “PropertyDictionaryRelationship.action”

7- Now you should have a new action called “PropertyDictionaryRelationship” as in the below screenshot

PropertyDictionaryRelationship Action in vRealize Orchestrator

 

 

For those of you who don’t trust downloading vRO actions from the internet, below is the contents of that vRO action as well how it looks like in my vRO.

var sample = new Properties();

if (key == “q”) {
sample.put(“9b30d29a-b386-481a-9a06-4f3216a32a0c”, “Production”);
}
if (key == “p”) {
sample.put(“9b30d29a-b386-481a-9a06-4f3216a32a0c”, “Production”);
}
if (key == “d”) {
sample.put(“8726caa7-f61e-455c-a976-1cf94b80c758”, “Development”);
}
if (key == “n”) {
sample.put(“8726caa7-f61e-455c-a976-1cf94b80c758”, “Development”);
}

return sample;

Here is a screenshot of how this vRO Action looked into my environment. Notice the return is a properties rather than string!

Property Dictionary Relationship Action Code

Now the workflow is ready, let’s create the Child Property dictionary and use the above vRO Action  to bind it to the Parent Property Dictionary.

  1. Go  to Administration => Property Dictionary => Property Definitions.
  2. Fill the information as shown in the below screenshot to establish the relationship using the earlier created vRO Action
  3. Fill the Property Definition as show in the above screenshot then hit Select next to Script Action
  4. Hit “Select” Next to “Script action:”.  Then choose the PropertyDictionaryRelationship we have created in previous steps as shown in the below screenshot. As well do the binding with the parent Property definition

Hit Edit next to Input Parameters to Configure the binding for the parent child relationship

Configure relationship with Parent by configuring binding as in the screenshot

 

Now you are almost done. All you need is to add your custom properties to your blueprint as shown below, and then your blueprint is ready to go with two dropdown menus with relationship/filtration between them.

Add your custom properties to your blueprint

Now if you go to request your blueprint, you should be able to experiment with the power of Property Dictionary Relationship!!


Leave a Reply

Your email address will not be published. Required fields are marked *