VMware Cloud Community
carl1
Expert
Expert
Jump to solution

vRA 8.2 and custom forms - Cannot add Value|Label from external value

For a drop-down list, you can specify a list of constant values in a Value|Label|Description form.  I would like to do the same from an external source but I cannot see how.  The drop-down list simply shows all the text instead of just the Label.  Any thoughts on how I can do this?

Thanks,
Carl L.

1 Solution

Accepted Solutions
xian_
Expert
Expert
Jump to solution

Create an action returning an Array of Properties. A sample code:

var dropdown = [];

dropdown.push(new Properties({label: 'label1', value: 'value1'}));

dropdown.push(new Properties({label: 'label2', value: 'value2'}));

return dropdown;

View solution in original post

6 Replies
xian_
Expert
Expert
Jump to solution

Create an action returning an Array of Properties. A sample code:

var dropdown = [];

dropdown.push(new Properties({label: 'label1', value: 'value1'}));

dropdown.push(new Properties({label: 'label2', value: 'value2'}));

return dropdown;

carl1
Expert
Expert
Jump to solution

Worked like a charm.  Thanks!!!

Carl L.

0 Kudos
Lakshika
Contributor
Contributor
Jump to solution

What should be the entity type of field in custom form in vRA to add this as an action because return type of action (Array/properties) does not match to string entity type in vRA

0 Kudos
xian_
Expert
Expert
Jump to solution

Element type should be Dropdown (or Text Field, but change the Display type to DropDown then).

0 Kudos
Lakshika
Contributor
Contributor
Jump to solution

Thank you for the response. I was creating a XAAS form and there I am not able to see that action(for fetching dropdown options )of return type (Array/Properties) as the entity type of my element in vRA is string.

 

 

0 Kudos
xian_
Expert
Expert
Jump to solution

Make sure to set the display type of your input string

xian__0-1652121568551.png

 

Then you should be able to select your action at Value options:

xian__1-1652121632200.png

The action I used here, returning array of Properties:

var options = new Array();

options.push(new Properties({value: "dev", label: "Development"}));
options.push(new Properties({value: "tst", label: "Test"}));
options.push(new Properties({value: "uat", label: "UAT"}));
options.push(new Properties({value: "prd", label: "Production"}));

return options;

 

0 Kudos