1

I'm using Drupal 7.

I have a simple "email confirmation" system set up using rules. The setup is this:

  1. "Reservation" Content Type has a boolean check box for "confirmed".
  2. "Reservation" Content Type has a hidden boolean check box for "confirmation email sent"
  3. Both #1 and #2 are empty by default.

Here is the Rules flow once an Admin checks "confirmed":

  1. Rules checks for "reservation" content type update.
  2. Rules validates two conditions: (1) "confirmed" == true AND (2) "email sent" == empty
  3. A confirmation email is sent to the user making the "reservation"
  4. The "email sent" field is set = true.

The system works fine if I make the "email sent" field visible in the "reservation" Content Type, but if it is hidden then the system breaks. When working correctly it sends exactly one email. When broken it sends emails every time the content changes.

When it is hidden the Rules flow still changes the value of "email sent" = true. It just doesn't validate it during the conditional phase.

This flummoxes me. Why would it not validate hidden field values?

{ "rules_reservation_confirmed" : {
    "LABEL" : "Reservation Confirmed",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update--lc_space_reservation" : { "bundle" : "lc_space_reservation" } },
    "IF" : [
      { "data_is" : { "data" : [ "node:field-confirmed-" ], "value" : "1" } },
      { "AND" : [ { "data_is_empty" : { "data" : [ "node:field-email-sent" ] } } ] }
    ],
    "DO" : [
      { "mail" : {
          "to" : "[node:field-email-address]",
          "subject" : "Your Language Commons reservation [node:title] is now confirmed.",
          "message" : "Your Language Commons reservation \u003Cem\u003E[node:title]\u003C\/em\u003E is now confirmed. Please click on \u003Ca href=\u0022[node:url]\u0022\u003Ethis link\u003C\/a\u003E for more information about your reservation. Please reply to this email with questions. ",
          "from" : "languagecommons@virginia.edu",
          "language" : [ "" ]
        }
      },
      { "data_set" : { "data" : [ "node:field-email-sent" ], "value" : "1" } }
    ]
  }
}
  • please update your question to include an export of your rule you have so far. that might help to understand the "Rules Conditional" part of your question ... PS: I can think of 2 possible causes for your issue, bit I first want to see your rule (toavoid guessing) ... – Pierre.Vriens Aug 22 at 18:59
  • Hi Pierre, thanks for your help. I'll add the export to the original post. – Jason Bennett Aug 26 at 20:11
  • @Pierre.Vriens Hey Pierre, forgot to hit the at key (not sure if that helps or not). Thanks for responding; see above. – Jason Bennett Sep 23 at 15:47

Your Answer

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

Browse other questions tagged or ask your own question.