I have created an endless loop within Rules that will evaluate nodes after they are created and reschedule itself as shown here: endless loop

I would like the loop to close after three emails have been sent. A counter could be added to the action set under "Send Email" then the conditions could include a Data Comparison to see if the counter is less than 3.

I have tried creating fields within the content type that would have the Rule Component increase the counter field by one every time the email section was executed then have a data comparison between the counter field and a Email Max field that had a default value of 3. I wasn't able to get this to work because the counter would not be increased.

Could this be done with an "Execute Custom PHP Code" action?

1 Answer 1


Going off memory here:

For both if and else, Add Action >> Set a Data Value >> node:field-email-max >> OFFSET: +1 (To get the offset, you will have to click the switch data selection button)

enter image description here

For both if and else >> Add Conditional >> Data Comparison >> node:field-email-max >> Less than 3

  • Going with the offset idea, Rules didn't let me have an offset with direct input as shown here Imgur. So I needed to use data selection to have the offset shown here Imgur. Then to have the the "max" field increase by one for each email, the counter feilded needed to increase as well since "max" was getting set to it. So both are getting set equal to each other then increased by one as shown here: Imgur. Which is an interesting way to do it but I guess it works. Would using PHP be cleaner?
    – KyleRiggen
    Jan 5, 2016 at 3:46
  • like I mention in my answer in Set Data Value you need to click on the Switch to data selection button
    – No Sssweat
    Jan 5, 2016 at 4:35
  • Great I appreciate your time No Sssweat!
    – KyleRiggen
    Jan 5, 2016 at 5:16
  • Interesting ... I didn't know/realize this about the Rules module ! Mar 31, 2016 at 21:05
  • @Pierre.Vriens hehe yeah hidden trick.
    – No Sssweat
    Mar 31, 2016 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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