From 075561f24f2a3ee82d6250737606c5c6735d81ac Mon Sep 17 00:00:00 2001 From: Busra Sengul Date: Tue, 23 Jan 2024 17:13:32 +0300 Subject: [PATCH] Update adding-a-workflowtype.md With Forms 13, there's a slight change in the Execute method :) --- .../developer/extending/adding-a-workflowtype.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/13/umbraco-forms/developer/extending/adding-a-workflowtype.md b/13/umbraco-forms/developer/extending/adding-a-workflowtype.md index 154c085719d..019f24f030d 100644 --- a/13/umbraco-forms/developer/extending/adding-a-workflowtype.md +++ b/13/umbraco-forms/developer/extending/adding-a-workflowtype.md @@ -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; @@ -32,7 +32,7 @@ namespace MyFormsExtensions this.Group = "Services"; } - public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context) + public override Task ExecuteAsync(WorkflowExecutionContext context) { // first we log it _logger.LogDebug("the IP " + context.Record.IP + " has submitted a record"); @@ -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 ValidateSettings() @@ -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: