Skip to content
Open
Show file tree
Hide file tree
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
32 changes: 24 additions & 8 deletions 10/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Adding a workflow type to Umbraco Forms

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

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.
You can create a custom workflow type by inheriting from `Umbraco.Forms.Core.WorkflowType` and implementing the required methods. For this example, the focus is on the `Execute()` method. This method process the current record (the data submitted by the form) and allows you to modify data and state.

## Creating a Custom Workflow

Add a new class to your project:

```csharp
using Serilog;
Expand Down Expand Up @@ -64,11 +68,23 @@ namespace MyFormsExtensions
}
```

## Information available to the workflow
### Controlling Workflow Execution

{% hint style="info" %}

All workflows configured for a stage (submission or approval) will execute regardless of whether earlier workflows fail or set the record state to `Rejected`.

However, setting `context.Record.State = FormState.Rejected` during a stage will prevent workflows in the **next** stage from executing. For example, if a submission workflow sets the state to `Rejected`, all approval workflows will be skipped.

{% endhint %}

To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.

## Information Available to the Workflow

### Record information
### 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 `Execute()` method receives a `WorkflowExecutionContext` object, 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 All @@ -90,15 +106,15 @@ If the field stores multiple values, they are delimited with a comma. In many ca
IEnumerable<string> selectedPrevalues = recordField.GetSelectedPrevalues();
```

### Form and state information
### Form and State Information

The `Form` references the form the record is from and `FormState` provides its state (submitted or approved).

Other context, such as the current `HttpContext`, if needed can be passed as constructor parameters (for example: the `HttpContext` can be accessed by injecting `IHttpContextAccessor`).

## Registering the workflow type
## Registering the Workflow Type

To use the new workflow type, you will need to register it as part of application startup.
To use your custom workflow type, register it at application startup:

```csharp
using Umbraco.Cms.Core.Composing;
Expand Down
34 changes: 25 additions & 9 deletions 13/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Adding a workflow type to Umbraco Forms
# Adding a Workflow Type to Umbraco Forms

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

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.
You can create a custom workflow type by inheriting from `Umbraco.Forms.Core.WorkflowType` and implementing the required methods. For this example, the focus is on the `ExecuteAsync()` method. This method processes the current record (the data submitted by the form) and allows you to modify data and state.

## Creating a Custom Workflow

Add a new class to your project:

```csharp
using Serilog;
Expand Down Expand Up @@ -64,11 +68,23 @@ namespace MyFormsExtensions
}
```

## Information available to the workflow
### Controlling Workflow Execution

{% hint style="info" %}

All workflows configured for a stage (submission or approval) will execute regardless of whether earlier workflows fail or set the record state to `Rejected`.

However, setting `context.Record.State = FormState.Rejected` during a stage will prevent workflows in the **next** stage from executing. For example, if a submission workflow sets the state to `Rejected`, all approval workflows will be skipped.

{% endhint %}

To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.

## Information Available to the Workflow

### Record information
### Record Information

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 `ExecuteAsync()` method receives a `WorkflowExecutionContext` object, 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 All @@ -90,15 +106,15 @@ If the field stores multiple values, they are delimited with a comma. In many ca
IEnumerable<string> selectedPrevalues = recordField.GetSelectedPrevalues();
```

### Form and state information
### Form and State Information

The `Form` references the form the record is from and `FormState` provides its state (submitted or approved).

Other context, such as the current `HttpContext`, if needed can be passed as constructor parameters (for example: the `HttpContext` can be accessed by injecting `IHttpContextAccessor`).

## Registering the workflow type
## Registering the Workflow Type

To use the new workflow type, you will need to register it as part of application startup.
To use your custom workflow type, register it at application startup:

```csharp
using Umbraco.Cms.Core.Composing;
Expand Down
34 changes: 25 additions & 9 deletions 15/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Adding a workflow type to Umbraco Forms
# Adding a Workflow Type to Umbraco Forms

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

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.
You can create a custom workflow type by inheriting from `Umbraco.Forms.Core.WorkflowType` and implementing the required methods. For this example, the focus is on the `ExecuteAsync()` method. This method processes the current record (the data submitted by the form) and allows you to modify data and state.

## Creating a Custom Workflow

Add a new class to your project:

```csharp
using Serilog;
Expand Down Expand Up @@ -64,11 +68,23 @@ namespace MyFormsExtensions
}
```

## Information available to the workflow
### Controlling Workflow Execution

{% hint style="info" %}

All workflows configured for a stage (submission or approval) will execute regardless of whether earlier workflows fail or set the record state to `Rejected`.

However, setting `context.Record.State = FormState.Rejected` during a stage will prevent workflows in the **next** stage from executing. For example, if a submission workflow sets the state to `Rejected`, all approval workflows will be skipped.

{% endhint %}

To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.

## Information Available to the Workflow

### Record information
### Record Information

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 `ExecuteAsync()` method receives a `WorkflowExecutionContext` object, 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 All @@ -90,15 +106,15 @@ If the field stores multiple values, they are delimited with a comma. In many ca
IEnumerable<string> selectedPrevalues = recordField.GetSelectedPrevalues();
```

### Form and state information
### Form and State Information

The `Form` references the form the record is from and `FormState` provides its state (submitted or approved).

Other context, such as the current `HttpContext`, if needed can be passed as constructor parameters (for example: the `HttpContext` can be accessed by injecting `IHttpContextAccessor`).

## Registering the workflow type
## Registering the Workflow Type

To use the new workflow type, you will need to register it as part of application startup.
To use your custom workflow type, register it at application startup:

```csharp
using Umbraco.Cms.Core.Composing;
Expand Down
34 changes: 25 additions & 9 deletions 16/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Adding a workflow type to Umbraco Forms
# Adding a Workflow Type to Umbraco Forms

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

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.
You can create a custom workflow type by inheriting from `Umbraco.Forms.Core.WorkflowType` and implementing the required methods. For this example, the focus is on the `ExecuteAsync()` method. This method processes the current record (the data submitted by the form) and allows you to modify data and state.

## Creating a Custom Workflow

Add a new class to your project:

```csharp
using Serilog;
Expand Down Expand Up @@ -64,11 +68,23 @@ namespace MyFormsExtensions
}
```

## Information available to the workflow
### Controlling Workflow Execution

{% hint style="info" %}

All workflows configured for a stage (submission or approval) will execute regardless of whether earlier workflows fail or set the record state to `Rejected`.

However, setting `context.Record.State = FormState.Rejected` during a stage will prevent workflows in the **next** stage from executing. For example, if a submission workflow sets the state to `Rejected`, all approval workflows will be skipped.

{% endhint %}

To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.

## Information Available to the Workflow

### Record information
### Record Information

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 `ExecuteAsync()` method receives a `WorkflowExecutionContext` object, 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 All @@ -90,15 +106,15 @@ If the field stores multiple values, they are delimited with a comma. In many ca
IEnumerable<string> selectedPrevalues = recordField.GetSelectedPrevalues();
```

### Form and state information
### Form and State Information

The `Form` references the form the record is from and `FormState` provides its state (submitted or approved).

Other context, such as the current `HttpContext`, if needed can be passed as constructor parameters (for example: the `HttpContext` can be accessed by injecting `IHttpContextAccessor`).

## Registering the workflow type
## Registering the Workflow Type

To use the new workflow type, you will need to register it as part of application startup.
To use your custom workflow type, register it at application startup:

```csharp
using Umbraco.Cms.Core.Composing;
Expand Down
32 changes: 24 additions & 8 deletions 17/umbraco-forms/developer/extending/adding-a-workflowtype.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Adding a workflow type to Umbraco Forms
# Adding a Workflow Type to Umbraco Forms

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

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.
You can create a custom workflow type by inheriting from `Umbraco.Forms.Core.WorkflowType` and implementing the required methods. For this example, the focus is on the `ExecuteAsync()` method. This method processes the current record (the data submitted by the form) and allows you to modify data and state.

## Creating a Custom Workflow

Add a new class to your project:

```csharp
using Serilog;
Expand Down Expand Up @@ -64,11 +68,23 @@ namespace MyFormsExtensions
}
```

## Information available to the workflow
### Controlling Workflow Execution

{% hint style="info" %}

All workflows configured for a stage (submission or approval) will execute regardless of whether earlier workflows fail or set the record state to `Rejected`.

However, setting `context.Record.State = FormState.Rejected` during a stage will prevent workflows in the **next** stage from executing. For example, if a submission workflow sets the state to `Rejected`, all approval workflows will be skipped.

{% endhint %}

To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.

## Information Available to the Workflow

### Record information
### Record Information

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 `ExecuteAsync()` method receives a `WorkflowExecutionContext` object, 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 All @@ -90,15 +106,15 @@ If the field stores multiple values, they are delimited with a comma. In many ca
IEnumerable<string> selectedPrevalues = recordField.GetSelectedPrevalues();
```

### Form and state information
### Form and State Information

The `Form` references the form the record is from and `FormState` provides its state (submitted or approved).

Other context, such as the current `HttpContext`, if needed can be passed as constructor parameters (for example: the `HttpContext` can be accessed by injecting `IHttpContextAccessor`).

## Registering the workflow type

To use the new workflow type, you will need to register it as part of application startup.
To use your custom workflow type, register it at application startup:

```csharp
using Umbraco.Cms.Core.Composing;
Expand Down