I have created a vRO workflow that takes a composite type (Array of IPaddress:Port) as input.
Is there any way to perform vRA validation using a vRO custom action on the XaaS Blueprint grid element that, everytime the user hits "+Add" and fill up the form, the action gets triggered to allow/deny the entry or at least displays a message that the combination is not allowed due to, for example, a network restriction.
Thanks!
Use the vRO presentation property Custom Validation and point it at an action that performs the validations.
You can pass that action whatever you like, referencing the current grid as #this. Any non-empty string you return as part of that action is considered a Failure with the exception message being whatever string you have returned.
For example:
Input Name: networkBindings
Input Presentation (Validation): GetAction("my.module", "myAction").call(#networkBindings)
myAction
try {
// If the field is required use the presentation property "Required"
// Shortcut on empty bindings makes for better vRO presentation bindings
if (!networkBindings || networkBindings.length === 0) {
return '';
}
const badBindings = networkBindings.filter(function filterBad(binding) { return !binding.ip || !binding.port; });
if (badBindings.length > 0) {
throw "One or more bindings are missing IP or Port information";
}
return '';
} catch (e) {
return e.toString();
}
Obviously using whatever validation criteria you actually need.
Use the vRO presentation property Custom Validation and point it at an action that performs the validations.
You can pass that action whatever you like, referencing the current grid as #this. Any non-empty string you return as part of that action is considered a Failure with the exception message being whatever string you have returned.
For example:
Input Name: networkBindings
Input Presentation (Validation): GetAction("my.module", "myAction").call(#networkBindings)
myAction
try {
// If the field is required use the presentation property "Required"
// Shortcut on empty bindings makes for better vRO presentation bindings
if (!networkBindings || networkBindings.length === 0) {
return '';
}
const badBindings = networkBindings.filter(function filterBad(binding) { return !binding.ip || !binding.port; });
if (badBindings.length > 0) {
throw "One or more bindings are missing IP or Port information";
}
return '';
} catch (e) {
return e.toString();
}
Obviously using whatever validation criteria you actually need.
Thanks steve, however - it didn't worked with #this but worked with #__current
Hope it helps someone else 😃
Anyways, I just noticed that it works on vRo but the validation isn't done 'on the fly' by vRa. Any hints?
Sorry, you're right. I got confused with the notion that you can refer to the current input (normally know as this in programming), and the Custom Validation presentation property is the only one that allows you to do this. I'll edit the existing post.
How are you attempting to consume it in vRA? Is the XaaS blueprint being consumed straight from the Catalog or as a component on a Blueprint?
If it is the latter is it when you're filling out the component on the blueprint or when attempting to request the blueprint and filling out the inputs? If the latter, is it the native form or a custom form?