Is there any suggested way to apply validations on input properties?
-
Tuesday, November 01, 2011 4:22 AM
Hi All,
Is there any suggested way to apply validations on the input properties of an custom .net activity? For example regex or enums etc.
For regex patterns:- suppose we have to put constraint on an input property by specifying the pattern. That means the input property has to satisfy that regex rule. Like one input property "Description", then for this property we can put the regex like "^[a-zA-Z0-9]{0,32}$".
For enums:- For this i mean that we should be able to specify some values for an input property, that means whatever value we enter for that input property, that value should be one of those enum values. Like one input property "PowerOption", so the input values can be "shutdown", "restart", "reset", "maintenace" etc.
Or I can say some functionality like in powershell has "ValidatePattern", "ValidateLength", "ValidateSet". Also there are transforms in the powershell, with the help of which we can do some task on input values of parameter before using them.
Please suggest.
Thanks,
Vinay Ravish
All Replies
-
Tuesday, November 01, 2011 5:10 AMModerator
You would need to provide your own input validation. If you are looking for basic validation such as is an input numeric etc., then you could use .NET built in functions for such purposes, but typically your input validation requirements are going to be based on what needs to be done with the input. For example, if you have a property that uses a selection with 5 potential options, then you will want to validate that one of the valid options was selected as opposed to some random or empty text etc.
I'm not aware of any .NET built-in functions comparable to "ValidatePattern", "ValidateLength" etc., but you could certainly create such functions and leverage them as part of your custom validation routines.
Regards,
Jeff.
- Marked As Answer by Vinay Ravish Tuesday, November 01, 2011 5:16 AM
-
Tuesday, November 01, 2011 5:16 AM
Thanks a lot Jeff,
- Vinay Ravish
-
Friday, November 18, 2011 2:37 AM
Hi
Not saying this is the only way or the best way, but my tool here allows an Orchestrator admin to generate a UI for a chosen runbooks and apply some validation to the parameters before running that workbook:
http://blogs.technet.com/b/yasc/archive/2011/11/17/orchestrator-remote-tools-2-0-fka-the-opalis-ui-generator.aspxHope this helps

