I am using rules 7.2.5 and the Workflow Field module.
I have a workflow wherein a user will create a 'request' node and an admin will approve/reject it.
I am trying to create a rule to notify the user whenever the admin approves or rejects the request.
I created a rule on the event 'workflow transition insert' as follows
{ "rules_after_workflow_change_notify_user" : {
"LABEL" : "after workflow change, notify user",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "workflow" ],
"ON" : { "WorkflowTransition_insert" : [], "WorkflowTransition_presave" : [] },
"DO" : []
}
}
However, I am unable to get to the node being acted upon inorder to get to the node author and send an email.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | token options.png | 33.93 KB | alansaviolobo |
| #4 | events.png | 13.74 KB | alansaviolobo |
| #2 | rules.png | 44.7 KB | alansaviolobo |
Comments
Comment #1
johnvYou use the wrong event. Transition insert is fired while adding states in admin ui. Choose other event.
Comment #2
alansaviolobo commentedThis is the list of workflow related events. I had picked up the one which seemed to be closest to what I want.
The others do not appear to be related to what I intend to do.
Comment #3
johnvYou need the executed transitions. You can easily test by adding each transition and see which is fired.
Comment #4
alansaviolobo commentedHi John,
I apologize for the inconvenience, but I am not able to get the correct tokens.
I added all the relevant events to the rule (as described in events.png).
When trying to add an action, The only token I get is "User who executed the transition" (as described in token options.png). I cannot get "Node/Entity on which this transition was executed" and then use it to get to the node:author
Comment #5
johnvDid you enable both Token and Entity Token modules?
Comment #6
alansaviolobo commentedYes, I can confirm that both token and entity_token are enabled.
Comment #7
alansaviolobo commentedthis got resolved.
I was trying to get to the author by token chaining ( WorkflowState:node:author ) which wasn't working.
the trick was to fetch the entity in a separate step before trying to access the author.