Rules Email notifications

Events happening in the community are now at Drupal community events on www.drupal.org.
krazykellie's picture

Hi everyone!

I hope that someone can help me better understand what I'm missing with the rules module. I'm curious if you can create a rule that will only fire once when a field selection has been selected. For instance, say you have a multi-page form for a content type. Once it reaches the end of page 3 you give individuals an option to send for approval. If they make the selection it would email a designated person (based on a previous selection, let's say by location). Right now I have a rule set up to accomplish this.

{ "rules_ppc_email_ready_for_manager_review_almonte_cloned_" : {
    "LABEL" : "PPC - Email - Ready for Manager Review - Almonte (Almonte)",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_presave--program_flow_chart_entry" : { "bundle" : "program_flow_chart_entry" } },
    "IF" : [
      { "data_is" : { "data" : [ "node:field-are-you-ready-for-your-sup" ], "value" : "yes" } },
      { "OR" : [
          { "data_is" : { "data" : [ "node:author:name" ], "value" : "ppc_al1" } },
          { "data_is" : { "data" : [ "node:author:name" ], "value" : "ppc_al2" } }
        ]
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "email@email.org, email@email.org",
          "subject" : "[node:field-flow-location:field_location_abbreviation] Program Added - [node:title]",
          "message" : "Hello LaVetta,\r\n\r\nProgram: \u003Cstrong\u003E[node:title]\u003C\/strong\u003E has been created and ready for your review. \r\n\r\nPlease visit:  [node:url] to look at the progress and add your feedback to the Manager\u0027s Actions (simply click the Edit button).",
          "from" : "webmaster@metrolibrary.org",
          "language" : [ "" ]
        }
      }
    ]
  }
}

But it continues to fire everytime someone edits it. :(

I've researched setting up additional events but I haven't been successful.

Can anyone help?

Comments

Single-Fire Rule

realEuph's picture

A couple of things I can think of:

1) Add a hidden (to regular users) field that indicates if the email has been sent. Your rule would set that field. It would only be visible to UID 1.

2) Have the Rule clear the field (assuming something like a checkbox) when the email is sent. That way subsequent edits could also request that the review email be sent.

Leonard Daly

Genius!

krazykellie's picture

Thanks Leonard! I'll give it a try!

Problems Still

krazykellie's picture

I've implemented a new rule to change a hidden field to a "review" status. But it seems that even after they go back in and edit, another email will be sent.

How do I stop it from repeatedly sending?

In Leonard's reply do step 1.

drunkencelt's picture

In Leonard's reply do step 1. but miss out step 2.

Then set a condition on your rule that checks the field which if set to "1" (indicating email sent) will not fire.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: