1

So I have a Drupal 7 Workflow rule where an email is sent out when a select field on a comment is set to "Approved'.

This works fine with the exception being if I then add an additional comment to the form, the email is then re-sent. the reason being is that I'm just checking the select field value and triggering the email based on the value.

I just want the email to be sent when the select field is initially set to "Approved".

Here is the export of the rule in question:

{ "rules_notify_status_approved_test" : {
"LABEL" : "Notify - Status Approved TEST",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--request_ad_match" : { "bundle" : "request_ad_match" }     },
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "request_ad_match" : "request_ad_match" } }
    }
  },
  { "user_has_role" : {
      "account" : [ "site:current-user" ],
      "roles" : { "value" : { "4" : "4" } }
    }
  },
  { "data_is" : { "data" : [ "node:field-request-status" ], "value" : "74" }     },
  { "AND" : [] }
],
"DO" : [
  { "variable_add" : {
      "USING" : { "type" : "user", "value" : [ "node:author" ] },
      "PROVIDE" : { "variable_added" : { "node_author" : "node author" } }
    }
  },
  { "mail" : {
      "to" : "email@email.com",
      "subject" : "request has been approved",
      "message" : "request has been approved",
      "language" : [ "" ]
    }
  }
]
}
}

Any direction is appreciated.

Thanks!

0

It seems that to get it to work, you should at least add yet another Rules Conditions, in which you compare the value of your field-request-status field, for both the original value (before editing the field) and the (new) updated value, to verify if they are different.

For a variation of your question, with way more details on this, refer to the accepted answer (disclosure: it's mine ...) to "How to send an email using Rules when a node's boolean field is changed?".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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