Is there a way to execute a Rules action in code?
I have a set of rules that e-mail the author when a certain Workflow state has been arrived at. In pseudo Rules logic:
Event: After updating existing content
IF NOT [node:workflow-old-state-name] == [node:workflow-current-state-name]
AND [node:workflow-current-state-name] == Published
DO E-mail Author
Which works just fine. Except, I invoke workflow_execute_transition directly in some places. This doesn’t execute my rule because it’s not After updating existing content. I’d like to manually execute my rule’s action (bypassing the conditions) after I call workflow_execute_transition. Possible?
This all feels like a bit of a workaround. Why doesn’t Rules have triggers for Workflow State Changed? Workflow is properly represented in core’s Trigger module, but not here in Rules.
Well… turns out Rules does have a
Workflow state has changedevent. I was just a version behind.So that solves this problem, now that
workflow_execute_transitionis properly triggering the rule.Much cleaner now!