VMware Cloud Community
francescor
Enthusiast
Enthusiast

Populate workflow input form element values with REST call result

I'm developing a custom workflows for creating Services and Services group in one or more NSX because workflows for this are missing in the NSX plugin and I had to use HTTP-REST plugin.

What I achieved at the moment is:

  • Create a Service
  • Create a Service group

Now I want to add Services to a Service Group, so I need to call another REST Operation, and I would like to populate the input form elements with the already existing services and service groups, in this way I can show to the user a dual list element where the user can select the services from.

I'm not able to find a specific documentation for this as the docs found in VMWare portal are just showing very basic stuff.

Is it possible to populate form element values with the result of a REST call?

Thanks in advance.

5 Replies
Hejahida82
VMware Employee
VMware Employee

To populate an input in vRO with a set of values returned from a REST operation you can do the following:

1. Create an action in vRO that performs the REST operation and returns a value or array of values in the format needed for the input form e.g. string format

2. Create a new workflow with an input parameter in the same format as the results from the REST operation in step 1

3. On the Presentation tab of the workflow edit the input parameter to use the Predefined Answers property and link it to the Action created in step 1

Now when you launch the workflow the action will be called by vRO, running the REST operation and populating the list of values for the workflow input parameter. You can perform these steps with multiple input parameters and REST operations, just create new actions for each REST operation and link them to individual input parameters e.g. one action and input parameter for Services, and one for Service Groups.

Whilst this article was created for a much earlier version of vRO the process to link the action to an input parameter is still valid and it is worth reading to understand how it works, the vCO Workflow Presentation section in particular will guide you through the configuration. https://www.vcoteam.info/articles/learn-vco/290-dynamic-input-values-based-on-other-inputs.html

francescor
Enthusiast
Enthusiast

Hi Hejahida82​,

thanks fr your reply. Is there a bug in the vCO UI client or else I am doing something wrong?

This is my action:

error_1.PNG

This is the input definition of my workflow:

error_2.PNG

This is the Form presentation of my workflow where I use the action to populate the input:

error_3.PNG

But the Workflow is reporting the following error:

error_4.PNG

Reply
0 Kudos
Hejahida82
VMware Employee
VMware Employee

Sorry slight correction. Try setting the output of the action to an array of strings before adding it to the input form. The error appears to suggest it wants an array even though you are only going to return a single value in your test.

Reply
0 Kudos
francescor
Enthusiast
Enthusiast

I have already tried that, but then it won't show in the form designer as a possible value. That's why I think there is a bug somewhere.

If you have any other suggestion you are more than welcome. In order to troubleshoot my error the only relevant page found in the documentation is this: Input Parameter Properties in the vRealize Orchestrator Client

Anyway thank you for your time.

Reply
0 Kudos
francescor
Enthusiast
Enthusiast

UPDATE:

by using the java client, the example of my previous screenshots is working, so I'm assuming there is something wrong in the HTML 5 client.

Regarding the original question I was able to develop an action returning correctly the array of Services but unfortunately I wasn't able to show then in the input form, because by using the java client there no way of mapping it, from the java client what I can do is just to specify the binding between the Action output and the input parameter.

Reply
0 Kudos