In this blog post we are going to show how to manage composite types in vRealize Orchestrator (vRO). You can group multiple parameters as class type that are logically linked in a new type called a composite type. I am going to show how to use composite types in code snippet.
Sample Composite Inputs
Name | Type |
name | string |
size | number |
checked | boolean |
Sample Scripts
Create the values in the table as objects.
var obj = new Object();
obj.name = "Rengar";
obj.size = 5;
obj.checked = true;
If you create this composite type as an array, you can put the object to into the array.
test.push(obj);
System.log("Array length = " + test.length); // length: 1
System.log("Listing to values");
System.log(test[0].name);
System.log(test[0].size);
System.log(test[0].checked);
You can also loop the array inside a forEach.
for each (var obj in test)
{
System.log("Name : " + obj.name);
System.log("Size : " + obj.size);
System.log("Checked : " + obj.checked);
}
If you want to reach each value in compose type without using an array, you can call the values as an object.
//This values come from the input.
System.log("Name : " + test.name);
System.log("Size " : + test.size);
System.log("Checked : + test.checked");
Do you want to call a workflow from an action?
Call a Workflow from an Action | VMware VIRTUALIZATION (umitdemirtas.com)
Hopefully this post has been informative for you. If you have a question, opinion or request about the article, you can contact us from the comments below or my email address. If you think this post is informative to others, be social and share it on social media! Thank you for reading !!
1 thought on “Manage Composite Types in vRO Script”