Problem/Motivation
Currently, CRM Case does not support structured workflows. While Drupal provides the Content Moderation module, its revision-based model is unsuitable for CRM cases. Case status changes represent state transitions, not editorial revisions.
A proper workflow system is needed to track case status changes, enforce valid transitions, and trigger actions like notifications, without introducing unnecessary revision complexity.
Steps to reproduce
- Enable CRM Case.
- Attempt to configure case status workflows using Content Moderation.
- Observe that the concept of "latest revision" or "default revision" does not make sense for Cases.
Proposed resolution
Integrate CRM Case with the core Workflow module to manage case status transitions.
- Each Case Type can reference a Workflow configuration entity.
- Add a required
workflowfield to each Case entity that stores the current workflow state. - Provide APIs to perform transitions, validate allowed transitions, and trigger a
crm_case.transitionevent. - Provide UI elements (dropdown or buttons) showing only transitions the current user is permitted to perform.
- Log transitions as Case Activities for auditing purposes.
- Optional integration with Drupal Actions or Rules to automate tasks such as notifications.
This approach avoids revision-based moderation, keeps workflow states simple and data-driven, and allows reporting and filtering on case status using Views or entity queries.
Remaining tasks
- Add
workflowfield to CRM Case entities. - Create a service for performing and validating workflow transitions.
- Add UI support for transitions per Case Type and user permissions.
- Log transitions in Case Activity stream.
- Create default workflow configuration for basic CRM usage.
- Document setup and usage instructions for site builders.
User interface changes
- Case edit and view forms display a dropdown or buttons for valid workflow transitions.
- Activity log shows historical workflow state changes.
- Views integration allows filtering and sorting by
workflow.
API changes
- New service for performing workflow transitions on Case entities.
- Dispatch
crm_case.transitionevents on state changes. - Expose
workflowfield for programmatic queries and Views.
Data model changes
- Add
workflowfield to store the current workflow state. - Case Types reference a Workflow configuration entity.
- No revisions are used; workflow state changes overwrite the current field value.
Issue fork crm_case-3554370
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bluegeek9 commentedComment #5
bluegeek9 commentedComment #8
bluegeek9 commented