Skip to content

Commit 48c14e0

Browse files
committed
Incorporated suggestion
1 parent d600b32 commit 48c14e0

File tree

5 files changed

+30
-120
lines changed

5 files changed

+30
-120
lines changed

10/umbraco-forms/developer/extending/adding-a-workflowtype.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,17 @@ namespace MyFormsExtensions
6868
}
6969
```
7070

71-
### Aborting Subsequent Workflows
71+
### Controlling Workflow Execution
7272

73-
If you want to stop further workflows from executing, you can change the record’s state to `Rejected` and return `WorkflowExecutionStatus.Failed`.
73+
{% hint style="info" %}
7474

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

77-
```csharp
78-
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
79-
{
80-
// Get a specific field value by alias
81-
var emailField = context.Record.GetRecordFieldByAlias("email");
82-
83-
// Check if the email is missing or invalid
84-
if (emailField == null || string.IsNullOrWhiteSpace(emailField.ValuesAsString(false)))
85-
{
86-
_logger.LogWarning("Workflow aborted: Email address is missing.");
77+
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.
8778

88-
// Set the record state to Rejected and stop further workflows
89-
context.Record.State = FormState.Rejected;
90-
return Task.FromResult(WorkflowExecutionStatus.Failed);
91-
}
92-
93-
// Continue workflow execution if condition passes
94-
_logger.LogDebug("Email provided: {Email}", emailField.ValuesAsString(false));
95-
return Task.FromResult(WorkflowExecutionStatus.Completed);
96-
}
97-
```
79+
{% endhint %}
9880

99-
This is useful when your workflow detects an error or fails a condition check and you want to abort the rest of the workflow pipeline.
81+
To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.
10082

10183
## Information Available to the Workflow
10284

13/umbraco-forms/developer/extending/adding-a-workflowtype.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,17 @@ namespace MyFormsExtensions
6868
}
6969
```
7070

71-
### Aborting Subsequent Workflows
71+
### Controlling Workflow Execution
7272

73-
If you want to stop further workflows from executing, you can change the record’s state to `Rejected` and return `WorkflowExecutionStatus.Failed`.
73+
{% hint style="info" %}
7474

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

77-
```csharp
78-
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
79-
{
80-
// Get a specific field value by alias
81-
var emailField = context.Record.GetRecordFieldByAlias("email");
82-
83-
// Check if the email is missing or invalid
84-
if (emailField == null || string.IsNullOrWhiteSpace(emailField.ValuesAsString(false)))
85-
{
86-
_logger.LogWarning("Workflow aborted: Email address is missing.");
77+
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.
8778

88-
// Set the record state to Rejected and stop further workflows
89-
context.Record.State = FormState.Rejected;
90-
return Task.FromResult(WorkflowExecutionStatus.Failed);
91-
}
92-
93-
// Continue workflow execution if condition passes
94-
_logger.LogDebug("Email provided: {Email}", emailField.ValuesAsString(false));
95-
return Task.FromResult(WorkflowExecutionStatus.Completed);
96-
}
97-
```
79+
{% endhint %}
9880

99-
This is useful when your workflow detects an error or fails a condition check and you want to abort the rest of the workflow pipeline.
81+
To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.
10082

10183
## Information Available to the Workflow
10284

15/umbraco-forms/developer/extending/adding-a-workflowtype.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,17 @@ namespace MyFormsExtensions
6868
}
6969
```
7070

71-
### Aborting Subsequent Workflows
71+
### Controlling Workflow Execution
7272

73-
If you want to stop further workflows from executing, you can change the record’s state to `Rejected` and return `WorkflowExecutionStatus.Failed`.
73+
{% hint style="info" %}
7474

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

77-
```csharp
78-
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
79-
{
80-
// Get a specific field value by alias
81-
var emailField = context.Record.GetRecordFieldByAlias("email");
82-
83-
// Check if the email is missing or invalid
84-
if (emailField == null || string.IsNullOrWhiteSpace(emailField.ValuesAsString(false)))
85-
{
86-
_logger.LogWarning("Workflow aborted: Email address is missing.");
77+
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.
8778

88-
// Set the record state to Rejected and stop further workflows
89-
context.Record.State = FormState.Rejected;
90-
return Task.FromResult(WorkflowExecutionStatus.Failed);
91-
}
92-
93-
// Continue workflow execution if condition passes
94-
_logger.LogDebug("Email provided: {Email}", emailField.ValuesAsString(false));
95-
return Task.FromResult(WorkflowExecutionStatus.Completed);
96-
}
97-
```
79+
{% endhint %}
9880

99-
This is useful when your workflow detects an error or fails a condition check and you want to abort the rest of the workflow pipeline.
81+
To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.
10082

10183
## Information Available to the Workflow
10284

16/umbraco-forms/developer/extending/adding-a-workflowtype.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,17 @@ namespace MyFormsExtensions
6868
}
6969
```
7070

71-
### Aborting Subsequent Workflows
71+
### Controlling Workflow Execution
7272

73-
If you want to stop further workflows from executing, you can change the record’s state to `Rejected` and return `WorkflowExecutionStatus.Failed`.
73+
{% hint style="info" %}
7474

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

77-
```csharp
78-
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
79-
{
80-
// Get a specific field value by alias
81-
var emailField = context.Record.GetRecordFieldByAlias("email");
82-
83-
// Check if the email is missing or invalid
84-
if (emailField == null || string.IsNullOrWhiteSpace(emailField.ValuesAsString(false)))
85-
{
86-
_logger.LogWarning("Workflow aborted: Email address is missing.");
77+
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.
8778

88-
// Set the record state to Rejected and stop further workflows
89-
context.Record.State = FormState.Rejected;
90-
return Task.FromResult(WorkflowExecutionStatus.Failed);
91-
}
92-
93-
// Continue workflow execution if condition passes
94-
_logger.LogDebug("Email provided: {Email}", emailField.ValuesAsString(false));
95-
return Task.FromResult(WorkflowExecutionStatus.Completed);
96-
}
97-
```
79+
{% endhint %}
9880

99-
This is useful when your workflow detects an error or fails a condition check and you want to abort the rest of the workflow pipeline.
81+
To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.
10082

10183
## Information Available to the Workflow
10284

17/umbraco-forms/developer/extending/adding-a-workflowtype.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,17 @@ namespace MyFormsExtensions
6868
}
6969
```
7070

71-
### Aborting Subsequent Workflows
71+
### Controlling Workflow Execution
7272

73-
If you want to stop further workflows from executing, you can change the record’s state to `Rejected` and return `WorkflowExecutionStatus.Failed`.
73+
{% hint style="info" %}
7474

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

77-
```csharp
78-
public override Task<WorkflowExecutionStatus> ExecuteAsync(WorkflowExecutionContext context)
79-
{
80-
// Get a specific field value by alias
81-
var emailField = context.Record.GetRecordFieldByAlias("email");
82-
83-
// Check if the email is missing or invalid
84-
if (emailField == null || string.IsNullOrWhiteSpace(emailField.ValuesAsString(false)))
85-
{
86-
_logger.LogWarning("Workflow aborted: Email address is missing.");
77+
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.
8778

88-
// Set the record state to Rejected and stop further workflows
89-
context.Record.State = FormState.Rejected;
90-
return Task.FromResult(WorkflowExecutionStatus.Failed);
91-
}
92-
93-
// Continue workflow execution if condition passes
94-
_logger.LogDebug("Email provided: {Email}", emailField.ValuesAsString(false));
95-
return Task.FromResult(WorkflowExecutionStatus.Completed);
96-
}
97-
```
79+
{% endhint %}
9880

99-
This is useful when your workflow detects an error or fails a condition check and you want to abort the rest of the workflow pipeline.
81+
To conditionally skip a specific workflow, add the conditional logic directly inside the workflow's `ExecuteAsync()` method.
10082

10183
## Information Available to the Workflow
10284

0 commit comments

Comments
 (0)