I seem to have tried every single combination of data comparison rules - but have come to a dead end.

I want to build this rule:

A user updates a SPECIFIC field in his/her user profile -> Rules sends out an email to a specific role on the site.

Note: whenever a user updates a DIFFERENT field in his/her user profile, we DON'T want Rules to send out any email. ONLY upon changes in THIS specific field.

Anyone? Thanks!!

Best,
Thomas

Comments

saurabh.dhariwal’s picture

Create rules.

1.Event: Before saving a user account.
2.Conditions: Data comparison (field save:change field)
3.Actions: send mail.

Import this rules:

{ "rules_change_in_username" : {
    "LABEL" : "change in username",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_presave" : [] },
    "IF" : [
      { "NOT data_is" : { "data" : [ "account-unchanged:name" ], "value" : "[account:name]" } }
    ],
    "DO" : [
      { "mail" : {
          "to" : "b@gmail.com",
          "subject" : "to alert",
          "message" : "field change",
          "from" : "a@gmail.com",
          "language" : [ "" ]
        }
      }
    ]
  }
}

Let me know if you face any query/concern regarding this.

Thanks!

thomas1977’s picture

@ saurabh.dhariwal

Thanks a lot for your suggestion! I actually got it working a different way, but I will keep your solution in mind when building similar functionality down the road. Thanks again!

Best,
Thomas

saurabh.dhariwal’s picture

Thanks Thomas!

Let me know incase of any query/concern regarding Drupal! Readily available to help :)

Thanks,
Saurabh

thomas1977’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.