Hello,

I have quite the situation. We are trying to send emails with instructional steps if certain conditions are met. Here's an outline of the workflow:

  1. A user has access to add and edit a content type.
  2. User creates a new node from that content type.
  3. User selects an option from one of the fields.
  4. User saves content.

We have a rule that is perfect when a user saves new content and the selection for the option is selected and data validated. Now the tricky part comes along with the same user.

  1. A user has access to add and edit a content type.
  2. User updates previous node from that content type.
  3. User did not get to select the option the first time they saved so they saved and went back into the node and made the selection.
  4. User saves content.

We have a rule that will email when content is updated. This works fine the first time. However, any other time the node is updated and the condition we established based on a selection option is valid, it will email them repeatedly every time an edit is completed and the node is saved.

Is there a way to limit the email to only send once if it is new with the condition met or updated with the condition met?

Because this one selection triggers an email with instructions they may make other edits on the page that is not related to the option selection but they may have just changed content in the body. But even then, it emails.

Please help!

Comments

Rizzle’s picture

I know this is an old issue, but no one ever responded. I was having the same issue, and while I would prefer the module take care of the solution with minimal effort, it just doesn't seem possible at this point. I have multiple roles all editing the same content, so essentially someone could receive multiple emails, when they should only receive the initial email and then never again.

So here is how I accomplished sending only one email after updating existing content. My example is sending a notification when someone adds a user to field "Appointment With". They should receive the initial email, but since they only need it once we need a way to ensure that rule will never validate after the first time.

1. In your content type, add a new checkbox field with value "Yes" (mine is called "appointment email sent")
2. Add a New Rule
3. Event: After updating existing content of type FDA Intake Form
4. Conditions
a. Data Comparison (use the data comparison to validate there is a value in the User Reference field you are using to send mail)
b. 'AND'
c. Data Value Is Empty (checking to see if the new field "appointment email sent" is empty)
5. Actions
a. Send Mail (send mail using the value your compared in the Data Comparison condition)
b. Set A Data Value (Now set your "appointment email sent" checkbox with a value of 'Yes')

Make sure the actions are executing in the order I listed. Otherwise, if the Send Email comes afterwards it won't actually send. So the next time someone updates existing content it will send an email and set the "appointment email sent" checkbox, so when the next person edits the content the rule will run but will not meet the conditions.

Thanks!

podarok’s picture

possible dgo.to/messages can help, because currently rules has no ability to send mail once only

TR’s picture

Status: Active » Fixed

If you want to send email "once", then someone, somewhere needs to store some data indicating that the email has already been sent.

This is NOT a Rules issue, this is a data model issue. YOU need to define a field that holds a boolean value indicating that the email has been sent, and YOU need to take care of setting/updating that field in order to keep track of sent emails. This is what #1 is saying.

OR, you can trigger on the "new content" saved event rather than the "updated content" event.

OR you can trigger on "updated content" but test certain values to see if they are changed before you send the email.

Regardless, this is not something that Rules can decide for you. You need to design your data model and workflow such that there are unambiguous conditions for sending email, then you can achieve the results you desire.

TR’s picture

Status: Fixed » Closed (fixed)