I have a node type that holds a field of users, when this node is saved I am emailing all the users in this field.

This node might be updated from time to time and I don't want to re-email these users, but I want to check for any new users added to this field.

What would be a good way to check this? Could I simply check $form_state against $form for that field when it is submitted, or is there a better way to achieve this?


1 Answer 1


You could use the Rules module for this. Similar to what is shown in my answer to "How to check with Rules if a new element has been added to a list in a node?".

By using the rule included in that answer, you can discover scenarios such as these:

Value [email protected] was removed from the multi value field.
Value [email protected] was added to the multi value field.

Here is a simplified version of the rule that should be pretty close to your case (to only show the inserted values):

{ "rules_verify_updates_to_selected_email_ids" : {
    "LABEL" : "Verify updates to selected eMail IDs",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules_conditional", "rules" ],
    "ON" : { "node_update--article" : { "bundle" : "article" } },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "node:field-email-addresses" ] },
          "ITEM" : { "current_email_id" : "Current eMail ID" },
          "DO" : [
            { "CONDITIONAL" : [
                  "IF" : { "NOT list_contains" : {
                      "list" : [ "node-unchanged:field-email-addresses" ],
                      "item" : [ "current-email-id" ]
                  "DO" : [
                    { "drupal_message" : { "message" : "Value [current-email-id:value] was added to the multi value field." } }

If you just replace the machine name "field-email-addresses" by the machine name of your field that contains the eMail id of the user (prior to import), you should be able to experiment with this rule in your own site to see it at work (for nodes of content type "Article", adapt this type to fit your needs).

All that's left to do is to transform the message that is displayed by sending an appropriate eMail (which is like a Rules-getting-started exercise).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.