Don't know if this is a Rules, Workflow or Tokens problem, or a combination? We are using the Rules module to kick-out an e-mail regarding the workflow state when content is updated. We have workflow states A, B and C. The node is created and workflow is first saved as state A. Then, we edit the node to change workflow state from A to B and save the node. Upon saving the changed node, the following token values are generated in using the Rules module:
node:workflow-current-state-name: A
node:workflow-old-state-name: (creation)
node_unchanged:workflow-current-state-name: A
node_unchanged:workflow-old-state-name: (creation)
Then, when updating yet a 2nd time, changing workflow state from B to C, the following token values are returned when Rules is triggered:
node:workflow-current-state-name: B
node:workflow-old-state-name: A
node_unchanged:workflow-current-state-name: B
node_unchanged:workflow-old-state-name: A
It seems impossible to get the actual current workflow state using tokens as the worklow changes. The "current-state" tokens are returning the old-state values, and the old-state tokens are returning the values from prior to that. This pattern then continues: one and two states behind.
Is this a bug or are we using the wrong tokens? Please advise on how to get the real current-state from the workflow values if not.
Environment includes: Drupal 6.6, Workflow 6.x-1.0-rc3 and Rules 6.x-1.0-beta3.
Comments
Comment #1
eromba commentedMy patch for #327144: workflow-state tokens are reversed should hopefully fix this issue.
Comment #2
fnikola commentedHas anyone noticed this behavior on the 5.x-2.2 version?
Comment #3
eromba commented@fnikola: Yes, the same problem exists in the 5.x branch as well. My patch (see #1) should also work for this version--you will just need to apply it manually.