I am having trouble setting up a rule to email a specific user referenced by a node. The structure I am trying to set up is:
When node of type A is updated, and satisfies certain criteria, the user referenced by node of type B, which is referenced by the original node of type A, should receive an email.
Below is the error log:
0 ms Reacting on event After updating existing content.
13.753 ms Evaluating conditions of rule Released Email. [edit]
15.155 ms The condition entity_has_field evaluated to TRUE [edit]
19.279 ms The condition entity_has_field evaluated to TRUE [edit]
19.535 ms The condition entity_has_field evaluated to TRUE [edit]
26.27 ms The condition data_is evaluated to TRUE [edit]
26.288 ms AND evaluated to TRUE.
" Rule Released Email (Maintenance Log) fires. [edit]
0 ms Rule Released Email (Maintenance Log) fires.
47.438 ms Unable to get the data value for the variable or parameter to. Error: Unable to get the data property mail as the parent data structure is not set.
48.391 ms Unable to evaluate action mail. [edit]
48.472 ms Rule Released Email (Maintenance Log) has fired.
And this is what the condition structure looks like:
Entity has field
Parameter: Entity: [node], Field: <referenced node>
Entity has field
Parameter: Entity: [node:<referenced node>], Field: <referenced user>
Data comparison
Parameter: Data to compare: [node:field-status:name], Data value: <desired value>
Export:
{ "released_email_maintenance_log" : {
"LABEL" : "Released Email (Maintenance Log)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : {
"node_insert--maintenance_interval" : { "bundle" : "maintenance_interval" },
"node_update--maintenance_interval" : { "bundle" : "maintenance_interval" }
},
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_project" } },
{ "entity_has_field" : { "entity" : [ "node:field-project" ], "field" : "field_pm" } },
{ "entity_has_field" : { "entity" : [ "node:field-project" ], "field" : "field_client" } },
{ "data_is" : { "data" : [ "node:field-status:name" ], "value" : "Released" } }
],
"DO" : [
{ "mail" : {
"to" : [ "node:field_project:field_pm:mail" ],
"subject" : "[node:field-project] is [node:field-status]",
"message" : "[node:field-project:0:field-client:title] maintenance updates are ready for your review here: [node:field_testing_url]\r\nFor more information, visit [node:url].",
"language" : [ "" ]
}
}
]
}
}
Based on the answer below, here is an updated export of the rule in question:
{ "released_email_maintenance_log" : {
"LABEL" : "Released Email (Maintenance Log)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : {
"node_insert--maintenance_interval" : { "bundle" : "maintenance_interval" },
"node_update--maintenance_interval" : { "bundle" : "maintenance_interval" }
},
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_project" } },
{ "entity_has_field" : { "entity" : [ "node:field-project" ], "field" : "field_pm" } },
{ "entity_has_field" : { "entity" : [ "node:field-project" ], "field" : "field_client" } },
{ "data_is" : { "data" : [ "node:field-status:name" ], "value" : "Released" } }
],
"DO" : [
{ "entity_fetch" : {
"USING" : { "type" : "user", "id" : [ "node:field-project:field-pm:uid" ] },
"PROVIDE" : { "entity_fetched" : { "user_fetched" : "Fetched user" } }
}
},
{ "mail" : {
"to" : [ "user-fetched:mail" ],
"subject" : "[node:field-project] is [node:field-status]",
"message" : "[node:field-project:field-client:title] maintenance updates are ready for your review here: [node:field_testing_url]\r\nFor more information, visit [node:url].",
"language" : [ "" ]
}
}
]
}
}
And the error this new configuration produces:
0 ms Rule Released Email (Maintenance Log) fires.
3.423 ms Unable to get the data value for the variable or parameter id. Error: Unable to get the data property uid as the parent data structure is not set.
5.291 ms Unable to evaluate action entity_fetch. [edit]
6.352 ms Unable to get variable user_fetched, it is not defined.
7.117 ms Unable to evaluate action mail. [edit]
7.177 ms Rule Released Email (Maintenance Log) has fired.