Skip to content

Make the first event added to a workflow its startup task (#16344) - #19896

Open
RAJEEV2510 wants to merge 3 commits into
OrchardCMS:mainfrom
RAJEEV2510:feature/16344-workflow-default-startup-task
Open

RAJEEV2510 wants to merge 3 commits into
OrchardCMS:mainfrom
RAJEEV2510:feature/16344-workflow-default-startup-task

Conversation

@RAJEEV2510

@RAJEEV2510 RAJEEV2510 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #16344

Background

A workflow only runs if one of its events is marked as the startup task. With a single event it's obvious which one that is, but you still have to set it by hand, and forgetting it leaves the workflow silently doing nothing (see also #18220, closed in favor of this issue). The issue discussion agreed on both an automatic default and a warning.

Change

  • Automatic default (ActivityController.Create): when an event is added and the workflow has no other events, the new activity is saved with IsStart = true. You can still turn it off with the existing start toggle. Tasks and later events are unaffected.
  • Warning on save (WorkflowTypeController.Edit POST): if the saved workflow has activities but no startup task, a warning notification is shown next to "Workflow has been saved."
  • WorkflowTypeExtensions.IsMissingStartActivity() (Workflows.Abstractions): a single check shared by the save warning and the list badge, with unit tests.
  • Workflow list (Views/WorkflowType/Index.cshtml): workflows with activities but no startup task get a "No startup task" badge next to the existing "Disabled" badge.

The editor keeps unsaved canvas changes in session storage. A newly added activity is taken from the server when the editor reloads, so its start flag shows up right away without any client-side script changes.

Testing

  • OrchardCore.Workflows builds with no warnings or errors (.NET SDK 10.0.401).
  • Not yet checked in a running site. Reviewers:
    1. Create a workflow and add an event (e.g. Content Created). It should show as the startup task (green).
    2. Add a second event. It should not be a startup task.
    3. Turn off the start flag on every event and save. A warning should appear, and the workflow list should show the "No startup task" badge.

@RAJEEV2510
RAJEEV2510 force-pushed the feature/16344-workflow-default-startup-task branch from dd81b81 to 7b51997 Compare September 16, 2026 18:09
…#16344)

A workflow never runs without a startup task, and it's easy to forget to
set one. Adding the first event to a workflow now marks it as the startup
task automatically. Saving a workflow that has activities but no startup
task shows a warning, and the workflow list shows a "No startup task" badge.
@RAJEEV2510
RAJEEV2510 force-pushed the feature/16344-workflow-default-startup-task branch from 7b51997 to 3849518 Compare September 16, 2026 18:10
@RAJEEV2510

Copy link
Copy Markdown
Contributor Author

@Piedone @MikeAlhayek @gvkries, could you please review this when you have a moment?

It adds both parts agreed on in #16344 (and #18220): the first event becomes the startup task automatically, and there's a warning plus a list badge when a workflow has no startup task. CI is green and the branch has no conflicts. Thanks!

Comment thread src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/ActivityController.cs Outdated
Adds a HasStartActivity extension, reuses it from IsMissingStartActivity,
and uses it when adding an activity so the activity library lookup is no
longer needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the first Event added to a workflow the startup task by default

2 participants