Some of the ingredients you'll need for a possible solution to make this work:
Read on for more details ...
Here is a rule, in Rules export format, which is a prototype of what you're trying to get to work:
{ "rules_notify_admin_of_selected_field_updates" : {
"LABEL" : "Notify admin of selected field updates",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_conditional" ],
"ON" : { "node_update" : [] },
"IF" : [
{ "OR" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_optionlist" } },
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_free_format_text" } }
]
}
],
"DO" : [
{ "variable_add" : {
"USING" : { "type" : "text", "value" : "Field changes applied to a node:" },
"PROVIDE" : { "variable_added" : { "field_changes" : "Added variable" } }
}
},
{ "CONDITIONAL" : [
{
"IF" : { "NOT data_is" : {
"data" : [ "node:field-optionlist" ],
"value" : [ "node-unchanged:field-optionlist" ]
}
},
"DO" : [
{ "data_set" : {
"data" : [ "field-changes" ],
"value" : "[field-changes:value] - Field Optionlist changed from \u0022[node-unchanged:field-optionlist]\u0022 to \u0022[node:field-optionlist]\u0022"
}
}
]
}
]
},
{ "CONDITIONAL" : [
{
"IF" : { "NOT data_is" : {
"data" : [ "node:field-free-format-text" ],
"value" : [ "node-unchanged:field-free-format-text" ]
}
},
"DO" : [
{ "data_set" : {
"data" : [ "field-changes" ],
"value" : "[field-changes:value] - Field Free Format Text changed from \u0022[node-unchanged:field-free-format-text]\u0022 to \u0022[node:field-free-format-text]\u0022"
}
}
]
}
]
},
{ "mail" : {
"to" : [ "site:mail" ],
"subject" : "Field changes in node with nid=[node:nid]",
"message" : [ "field-changes" ],
"language" : [ "" ]
}
}
]
}
}
Some more details about the above rule:
It showcases updates to (only) 2 fields, i.e.:
- a selection list field with machine name
field_optionlist
, and a few possible values.
- a free format text field with machine name
field_free_format_text
.
The Rules Actions "Add a variable" is to create an appropriate variable.
- The Conditional Rules module allows for including like "Rules Conditions" within the Rules Actions.
- Using "Set a data value" we append what's appropriate to that variable.
- In the end (last Rules Action), we make Rules send an eMail with an extremely basic eMail body: the content of the variable we populated in the previous Rules Actions.
Assuming that you enabled the Conditional Rules module, you should be able to import the rules example above in your own environment (provided you first defined 2 similar fields with identical machine names to make the import work, or after you first edit the field names to match your field names).
Homework:
- Extend the prototype from 2 to 20 fields (= sames as except ...).
- You may want to improve the formatting of the eMail body, eg add some relevant HTML tags in it to make it more readable. Maybe also its subject, etc.
Voilà, happy (Conditional) Rules-ing!
PS: Would be nice if you could use a Rules "loop" to iterate over all 20 fields in a single loop, similar to what is shown in the answer to "How to create a rule to send an email to a list of selected email addresses?". However I'm not aware of anything in Rules to do so.