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.

Comments

johnv’s picture

You use the wrong event. Transition insert is fired while adding states in admin ui. Choose other event.

alansaviolobo’s picture

StatusFileSize
new44.7 KB

This 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.

johnv’s picture

You need the executed transitions. You can easily test by adding each transition and see which is fired.

alansaviolobo’s picture

StatusFileSize
new13.74 KB
new33.93 KB

Hi 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

johnv’s picture

Did you enable both Token and Entity Token modules?

alansaviolobo’s picture

Yes, I can confirm that both token and entity_token are enabled.

alansaviolobo’s picture

Status: Active » Closed (fixed)

this 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.