Drupal core workflows not working for me

Created on 1 May 2023, over 1 year ago
Updated 4 September 2023, about 1 year ago

Problem/Motivation

Workflows state changes are not being recognized in ECA. I'm using core workflows.

Steps to reproduce

1) Use the ECA Workflow state workflow state transition template.
2) Configure for a state change from pending to completed, yes I have made sure I have the correct machine names
3) The action is to send an email
It just doesn't work. ECA works fine for sending an email when a basic page is created etc.

Proposed resolution

Coding a fix for this is unfortunately above my level of expertise.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Fixed

Version

1.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jeffgtr
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Maybe there is a configuration issue in the ECA model? I'm asking because we do use such transition events successfully, so I doubt this is a bug. If you could provide a simplified ECA model which reproduces the "error", we can have a look what's wrong.

  • Sure. Here is a link to screenshots of the configuration. The workflow states are created by the Entity Registration module.

    https://jmurphydev.com/eca-module-configuration

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Did you know you can export a model and then upload the exported archive here? That's much better than screenshots.

    Anyways, in this case it looks like the condition is somehow not really an empty condition. You may want to delete that link between event and action and then add a new one without ever selecting a template for that condition.

    And last but not least, there is a section Debugging in the ECA Guide which will show you where the processing actually stops. It could be the event, which doesn't match the transition, or that condition which is my assumption here, or some permission check anywhere in the model.

  • Thank you for your quick reply, it's very much appreciated. So I started over and created a new model and turned on debugging in the log. The model I created that sends an email when a basic page is created shows up in the log. The process for the workflow state change never shows in the log. I'm uploading the exported model. I'm wondering if this could be an issue with the Entity Registration module however it is using the core Workflow and everything is working on that end.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Unfortunately, that model does not come with all its dependencies. Have you disabled dependency calculation in ECA settings?

    The process for the workflow state change never shows in the log.

    Well, if the event is not showing up there, it won't be dispatched, and it is necessary to find out why that's the case. Maybe a special implementation by the entity registration module?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    What could also be the case, that you're hit by the core bug at πŸ› Wrong revision can be loaded into original in \Drupal\Core\Entity\EntityStorageBase::doPreSave Needs work which prevents Drupal to recognize a workflow state change. You may want to apply the patch from MR3599 and see if that makes any difference.

  • I applied the patch. Still not working

  • This appears to be isolated to the Entity Registration module. I submitted this as a bug with them and they responded they are going to try and get it working this week. Just in case anyone else is struggling with this issue.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Thanks a lot @jeffgtr for following up on this one. Hope, it gets resolved in Entity Registration. If any adjustment was needed at our end, we're happy to help.

  • Letting you know that there is a fix for the Entity Registration module. The fix is in the dev version I have tested and everything works fine.

  • πŸ‡©πŸ‡ͺGermany mxh Offenburg

    Linking to related issue. ATM I'm not sure whether that is or was the right approach. Workflow transitions should be recognized by ECA, without any special integration. Unless there is special behavior, of course.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Workflow transitions should be recognized by ECA, without any special integration.

    Yes, for sure. But that other module doesn't seem to be doing a workflow transition that could be recognized by ECA. I haven't looked at all the code there, but I couldn't find anything that would have indicated a workflow transition. That's why they implemented a special case, just for their way of dealing with workflows, it appears.

  • Status changed to Fixed over 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡ΊπŸ‡ΈUnited States alex.verhoeven

    I am also experiencing this issue. I think it probably does relate to the core issue https://www.drupal.org/project/drupal/issues/3346430 πŸ› Wrong revision can be loaded into original in \Drupal\Core\Entity\EntityStorageBase::doPreSave Needs work

    To reproduce:

    • Create new node as Draft
    • Change state to Review
    • The model recognizes the state change and executes the email action
    • Change state back to Draft
    • The model recognizes the state change and executes the email action
    • Change state to Published
    • The model recognizes the state change and executes the email action
    • Create a new Draft on the existing node
    • Change state to Review
    • The model recognizes the state change and executes the email action
    • Change state back to Draft
    • The model DOES NOT recognize the state change and does not execute the action

    So this only happens for me when I'm working with a new draft on an existing, published node

  • Status changed to Fixed about 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    I am also experiencing this issue. I think it probably does relate to the core issue https://www.drupal.org/project/drupal/issues/3346430 πŸ› Wrong revision can be loaded into original in \Drupal\Core\Entity\EntityStorageBase::doPreSave Needs work .

    Yes, that's caused by that core bug. There are several attempts to fix that, but I'm not sure how far back this fix will be ported from 11. You may want to apply a patch to core which resolves that in older versions.

Production build 0.71.5 2024