Today a basic tutorial on vRealize Orchestrator 8.X drop-down boxes in a form. With a basic drop-down box, you can improve the user experience in selecting and requesting items from your cloud management portal (CMP). By using drop-down boxes you can leverage easy validation and responses based on other drop-down boxes in your form.
In this tutorial, we are going to create dropdown boxes that respond to each other based on the user’s selection. This can be handy for improving the user experience. Sometimes the list can become very big with numerous options. By sub-selecting a group and filtering to a smaller list of options the user can easier make his decision.
Keep in mind:
- This tutorial is focused on vRealize Orchestrator 8.X but can still be leveraged in vRealize Orchestrator 7.X with some minor modifications.
- This tutorial is also usable for vRealize Automation 8.X forms. This can be leveraged by the Service Broker component by importing vRealize Orchestrator workflows.
Use Case
To give you some background around the code and usability. Let’s assume we are developing a workflow for creating Virtual Machines in vSphere. Based on user input surrounding the Operating System information we can determine the type of virtual machine that will be created when the request is submitted. We can also limit the user to some standard options like only Windows 10 or Windows Server 2019.
Keep in mind: this blog post is only focused on the form part, not on the actual creation of the virtual machine in vSphere.
vRO Actions
The first action we are going to create is called “formVmOsFamily“. This will display three values in the form. Based on what you select here the second action will be triggered.
/*
Script name: formVmOsFamily
Inputs:
- None
Return Type:
- vRO 8.X: string:array
Description field:
Author: M. Buijs - ITQ
Developed by: M. Buijs - ITQ
Date: 2021-08-17
Version: 1.0.0
Description: This action returns the available Guest Family of the Operating Systems.
*/
// Operating System Family list
return [
"Linux",
"VMware",
"Windows"
];
Here is the second action that is called “formVmOsGuest“. This will respond to the input provided by the operating system family in the interface.
/*
Script name: formVmOsGuest
Inputs:
- osFamily (string) = Operating System Family
Return Type:
- vRO 8.X: string:array
Description field:
Author: M. Buijs - ITQ
Developed by: M. Buijs - ITQ
Date: 2021-08-05
Version: 1.0.0
Description: This action returns the available Guest Operating Systems.
*/
// Input validation
if (osFamily == "" || osFamily == null) {
return ["Please select the Operating System family first"];
}
// Linux
if (osFamily == "Linux")
return [
"CentOS 6 (64-Bit)",
"CentOS 7 (64-Bit)",
"CentOS 8 (64-Bit)",
"Debian 10 (64-Bit)"
];
// VMware
if (osFamily == "VMware")
return [
"VMware ESXi 6.0",
"VMware ESXi 6.5",
"VMware ESXi 6.7",
"VMware ESXi 7.0"
];
// Windows
if (osFamily == "Windows")
return [
"Windows 10 (64-Bit)",
"Windows Server 2016 (64-Bit)",
"Windows Server 2019 (64-Bit)",
"Windows Server 2022 (64-Bit)"
];
Here is an overview of screenshots of how it should look like when created the actions in vRealize Orchestrator:
vRO Workflow
Here is the vRealize Orchestrator workflow, I have created an empty workflow and only configured the input form dropdown part! This will help you to set up the workflow so that the actions will work in your environment. The important part is not to forget to configure the workflow inputs and listed below:
Inputs:
- virtualMachineOsFamily (string)
- virtualMachineOsGuest (string)
Recording
Here is a recorded video of the input form dropdown boxes in action. The video demonstrates the capability of dropdown boxes and what they can deliver for a customer. It also gives you an idea of what you will get after creating the workflow and actions.
Improvements/Guidance
If you are going to use this code in production… You might need to consider some important points:
- Always create a list of supported Operating Systems that are used and allowed to be used in your Company. More options will not always simplify the deployment for an end-user.
- You could store the values in a vRealize Orchestrator Configuration Element depending on how frequently this list is changed.
Summary
So this concludes my blog post about creating dropdown boxes in vRealize Orchestrator and reacting on the input. Hopefully, this was useful for somebody getting started with interfaces in vRealize Automation (vRA) or vRealize Orchestrator (vRO). Please respond in the comment section below if you have any questions or remarks!