Open utterances-bot opened 2 years ago
Awesome write up!!! Was hoping you could assist. Instead of using the JSON place holder, would you be able to explain a little bit on how to sort a list of users that you manually create in vRO like you showed in your previous article with the array? I'm not making the correlation on how you would call the list of manual users through getUsersSorted action instead of the JSON place holder example that you used.
Actually, I figured it out. It was an oversight on my part! This is awesome. If I did this correctly you pretty much need a sorted and unsorted list. The unsorted list for the Cloud Template, and then the sorted list for the custom form to make it more user friendly? Then when adding new values, we would just add them to both the unsorted and sorted list? Any idea why the test throws that error that you took a screenshot of?
That is right: the unsorted action should return Properties (causing the list being unsorted), and use array of Properties (sorted) for the custom form to make the dropdown more user friendly. I believe this is some sort of regression (compared to vRA7) where you could use both. The Cloud Template engine (though it can display array of Properties) throws an error when you select an item of the array, so the workaround I found was to duplicate the action and implement the dropdown both sorted and unsorted. Usually I create the business logic (how I fetch the list of users) in one action and the other action just reuse the values. Sometimes it is easier to create an ordered list first, then dump the values into a wrapper action as unsorted. Sometimes it is easier the other way around.
Good one.
Thanks for this post, awesome. I have noticed another workaround by using the context.
I was retrieving the projectId with System.getContext().getParameter("_projectId")
to after retrive custom properties of project to provide them in the request form. Dropdown labels worked well, but i got a similar error on submitting: Value is not in list of valid values []
, with an empty list.
I conclued that the action is trigered 2 times: First with context for dropdown content, second with no context for validation of value.
You can so, in the same action, return either an array of properties for clean dropdown, or an array of string with only the values for the validation process, if there is no context. Remember to set the Return type as Array of Any.
Also there is another workaround described here. And it seem to be resolved in Aria Automation 8.13.1
vRA8 External Inputs and Input Property Groups | CMA
Dynamic dropdowns with Cloud Templates
https://kuklis.github.io/cma/post/vra8-external-inputs-and-input-property-groups/