| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This sample demonstrates how to create workflows that require human interaction using the WorkflowCore.Users extension.
public class HumanWorkflow : IWorkflow
{
public void Build(IWorkflowBuilder<object> builder)
{
builder
.StartWith(context => ExecutionResult.Next())
.UserTask("Do you approve", data => @"domain\bob")
.WithOption("yes", "I approve").Do(then => then
.StartWith(context => Console.WriteLine("You approved"))
)
.WithOption("no", "I do not approve").Do(then => then
.StartWith(context => Console.WriteLine("You did not approve"))
)
.WithEscalation(x => TimeSpan.FromSeconds(20), x => @"domain\frank", action => action
.StartWith(context => Console.WriteLine("Escalated task"))
.Then(context => Console.WriteLine("Sending notification..."))
)
.Then(context => Console.WriteLine("end"));
}
}Task Assignment: The workflow creates a user task with the prompt "Do you approve" and assigns it to domain\bob
User Options: Two options are provided:
Escalation: If the task is not completed within 20 seconds, it automatically escalates to domain\frank and executes the escalation workflow
User Interaction: The program demonstrates how to:
This sample requires the WorkflowCore.Users extension package, which provides the human workflow capabilities.
This pattern is useful for:
| Back | FazBrowse Home | New Git URL |