LHarris
Contributor
Contributor

Validate VMName / Hostname in input field before executing workflow

Jump to solution

I'm trying to figure out if it's possible to validate input fields before executing a workflow. The scenario I have is provisioning a new virtual machine. The user must input both the VMname and the hostname prior to submitting the workflow. I have a couple of actions which will check to see if a VMname or hostname is already in use. What I want to be able to go is stop the user from submitting the workflow for execution if the names entered already exist. Is there a way I can do this?

Thanks

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

If the action returns an empty string (or null), this will be treated as successful validation.

Any non-empty string will be treated as failed validation, and the string value will be displayed as an error message in the workflow presentation wizard.

(If your action return type is not a string but something else, and you don't want to change it, you can construct OGNL expression in the custom validation property editor that will compare the result from GetAction().call() with the desired value and will return either empty string or error message string.)

View solution in original post

0 Kudos
3 Replies
cdecanini_
VMware Employee
VMware Employee

Sure. There is a presentation properties "Custom Validation" for that. Just use it with an action checking if the name already exist or not.

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 vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
LHarris
Contributor
Contributor

Thanks for the reply. Does the action need to return something specific to make the custom validation work? Like a boolean true/false value?

0 Kudos
iiliev
VMware Employee
VMware Employee

If the action returns an empty string (or null), this will be treated as successful validation.

Any non-empty string will be treated as failed validation, and the string value will be displayed as an error message in the workflow presentation wizard.

(If your action return type is not a string but something else, and you don't want to change it, you can construct OGNL expression in the custom validation property editor that will compare the result from GetAction().call() with the desired value and will return either empty string or error message string.)

0 Kudos