Trying to get an mail-update when a tag is selected (if a node is inserted or updated).
The debug shows that 'till the second condition, everything is working fine. The second condition should be comparing if tid = 22 is selected. And i can't get this working ..
The name of the vocabulary is 'zichtbaarheid' (dutch for visibility).
{ "rules_vinkje_k_n_mail" : {
"LABEL" : "Vinkje K\u0026N \u003E mail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert" : [], "node_update" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_zichtbaarheid" } },
{ "data_is" : {
"data" : [ "node:field-zichtbaarheid" ],
"value" : { "value" : { "22" : "22" } }
}
}
],
"DO" : [
{ "mail" : {
"to" : "\[email protected]\u003E",
"subject" : "[node:title]",
"message" : "[site:current-date]\r\n\r\n[node:body]",
"language" : [ "" ]
}
}
]
}
}
The debug shows
...
10.619 ms The condition entity_has_field evaluated to TRUE [edit]
11.293 ms The condition data_is evaluated to FALSE [edit]
...
=== EDIT ===
The correct config is as following. Events: after saving new content & after updating
- First condition (to 'load' the terms): [entity has field] > in Data selector [node] & in Field the correct vocabulary
- Second condition: [List contains items] > Data selector: node:[fieldname]. In next screen, switch to [direct input mode]. Terms should be visible in a dropdown-menu. Choose the right value
And the export is (you should alter some settings, like the name):
{ "rules_twee_vinkje_k_n_mail" : {
"LABEL" : "TWEE Vinkje K\u0026N \u003E mail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert" : [], "node_update" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_zichtbaarheid" } },
{ "list_contains" : { "list" : [ "node:field-zichtbaarheid" ], "item" : "22" } }
],
"DO" : [
{ "mail" : {
"to" : "\[email protected]\u003E",
"subject" : "[node:title]",
"message" : "[site:current-date]\r\n\r\n[node:body]",
"language" : [ "" ]
}
}
]
}
}
(replace node:field-zichtbaarheid with your term-name, like field-tags)
And, as bonus to prevent recursion: I've added the term 'mail send' in the vocabulary. This term is hidden, but updated with an action. When firing the rule, the second condition is now to check if the term 'mail send' is checked or not. If checked, the output is false and the rule is not further executed.