Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions 13/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

*This builds on the "[adding a type to the provider model](adding-a-type.md)" chapter*

Add a new class to your project and have it inherit from `Umbraco.Forms.Core.WorkflowType`, implement the class. For this sample we will focus on the execute method. This method process the current record (the data submitted by the form) and have the ability to change data and state.
Add a new class to your project and have it inherit from `Umbraco.Forms.Core.WorkflowType`, and implement the class. For this sample, we will focus on the execute method. This method processes the current record (the data submitted by the form) and have the ability to change data and state.

```csharp
using Serilog;
Expand Down Expand Up @@ -32,7 +32,7 @@ namespace MyFormsExtensions
this.Group = "Services";
}

public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context)
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
{
// first we log it
_logger.LogDebug("the IP " + context.Record.IP + " has submitted a record");
Expand All @@ -53,7 +53,7 @@ namespace MyFormsExtensions
_logger.LogDebug("The record with unique id {RecordId} that was submitted via the Form {FormName} with id {FormId} has been changed to {RecordState} state",
context.Record.UniqueId, context.Form.Name, context.Form.Id, "approved");

return WorkflowExecutionStatus.Completed;
return Task.FromResult(WorkflowExecutionStatus.Completed);
}

public override List<Exception> ValidateSettings()
Expand All @@ -68,7 +68,7 @@ namespace MyFormsExtensions

### Record information

The `Execute()` method gets a `WorkflowExecutionContext` which has properties for the related `Form`, `Record`, and `FormState`. This parameter contains all information related to the workflow.
The `ExecuteAsync()` method gets a `WorkflowExecutionContext` which has properties for the related `Form`, `Record`, and `FormState`. This parameter contains all information related to the workflow.

The `Record` contains all data and metadata submitted by the form. As shown in the example above, you can iterate over all `RecordField` values in the form. You can also retrieve a specific record field by alias using the following method:

Expand Down