Genpact Cora Knowledge Center

Support

Validate a Workflow

Use this API sample to validate a workflow.

IWorkflowEngine engine = WorkflowRuntime.Engine;
Workflow workflow = engine.GetService<IWorkflowDefinitionService>().GetWorkflow(workflowId);

ValidationContext validationContext = new ValidationContext(engine);
validationContext.Options.IsRecursive = true;

Validator validator = Validator.GetValidator(workflow, engine);
validator.Validate(validationContext);


foreach(ValidationError error in validationContext.Errors)
{
 //do whatever you want with an error…
}