Question

In WF4 custom activities, I understand you can add warning of validation error by checking some condition and add validation error, ex

if(Arg == null)
metadata.AddValidationError("Null argument");

in CacheMetadata(metadata)

My question if what if you want to check the content of the argument itself, for example you want to check whether the value of Arg (an InArgument<String>) contains exactly 8 characters, and add validation error otherwise? Is this possible? How?

Was it helpful?

Solution

You won't get the actual data until the activity executes so you would need to do these checks in the Execute method at runtime. And depending on your preference and needs you can either set an error code OutArgument or throw an exception that can be caught in the workflow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top