VMware Cloud Community
rob200sx
Contributor
Contributor

Populating a dropdown based on the value of another dropdown

Hi folks, i'm new to VCO, so please excuse a certain degree of ignorance as I'm still learning 🙂

So here's what I'm trying to achieve: A workflow with three fields

1) An application version (predefined array)
2) Name of a SQL Server (array of servernames retrieved from a sql query)
3) Name of a Database (array of databases retrieved from a sql query)

 

Then pass these to a powershell script to run.

Independently, these work. I can choose from the dropdowns and these are passed to my powershell script.

What I now would like, and am having difficulty with, is having the dropdown of #3 change based on the value selected from #2, because I want to constrain the user of the workflow to only the databases that exist on the specified SQL server.

I'm not quite sure how I can manage this though. how would I achieve this?

 

Thanks in advance.

6 Replies
daphnissov
Immortal
Immortal

Here's one way to do it which is pretty easy.

if (myInput == "" || myInput == null){

return ["Please select a value above."];}

if (myInput == "one"){

return [

"A",

"B",

"C"

];}

if (myInput == "two"){

return [

"D",

"E",

"F"

];}

if (myInput == "three"){

return [

"G",

"H",

"I"

];}

You create myInput as an input to the form and in JS based on myInput value you return a static list of results. Similarly with better formatting:

if (arg0 == null) {

  return [];

}

if (arg0 == "a") {

  return ["a1", "a2", "a3"];

}

return ["b1", "b2", "b3"];

0 Kudos
rob200sx
Contributor
Contributor

Thanks, but unfortunately this doesn't address the dynamic nature of my requirement, as there isn't an IF here, there will always be a SQL server and there will always be databases on each SQL Server, my issue is not knowing how to change what's populated in the database dropdown when the database server dropdown changes.

0 Kudos
Burke-
VMware Employee
VMware Employee

Have you read my article here? https://www.vcoteam.info/articles/learn-vco/290-dynamic-input-values-based-on-other-inputs.html While that article deals with AD users, the technique is similar for anything else.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
hawks76
Enthusiast
Enthusiast

Hey @Burke, I tried to access the link you provided, but i get a 403 - access denied error, and the same on vcoteam.info.

0 Kudos
Burke-
VMware Employee
VMware Employee

I just used two different browsers from my home system and a 3rd different browser in a remote system on my corp network - in all cases, the link came up just fine...

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
hawks76
Enthusiast
Enthusiast

Ugggh.. Looks like Websense strikes again.  😐
0 Kudos