Stopping Rule Processing

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

I am wondering about a Rules action that stops rule processing.

I created two rules, both of which trigger on "After updating existing content." Both operate on a certain content type.

The first sends an email whenever any field of the content type has been modified.

The second checks to see if a field is empty and if it is not, uses the Set a data value action to set the value of another field to the current date and time.

The problem is that both rules would run and, presumably because Rule 2 updated content, both rules would run a second time, resulting in two emails.

What I was looking for was an action that I could put in Rule 2 that would stop any further rule processing, but I couldn't find such an action.

Then I tried using the Add a variable action to set a variable in Rule 2 that would then be detected as a condition in Rule 1, but I couldn't figure out how to get Rule 1 to see the variable.

I ended up getting it to work by using the custom PHP action and custom PHP condition, but I'm curious if there's a better way.

Should I have used a Rule Set?

  • Ethan

Comments

Yes!

itangalo's picture

You should definately be using a rule set. I most of the time find myself building a rule set like "Actions when articles are saved" and then calling that from the right event triggers.

When collecting all actions in a rule set -- in separate rules -- you can have conditions on each rule to only run the things you want. In Rules for Drupal 6 (is that what you're using?) you can also load new variables in one rule and pass it on to another in the same rule set.

Good luck!
//Johan Falk
I'm a part of the Rules Issue Squad, helping out in the issue queue. You can join, too!

Thanks

esomething's picture

Thanks for the quick response.

I see that I can export and import rules, but can I export a rule and then import it into a component's rule set or do I have to just recreate the rules in the rule set manually?

Redo from start

itangalo's picture

You'll have to create the rules from scratch, I'm afraid. In Drupal 7 it works much easier.

Good luck,
//Johan Falk

I'm Using D7

esomething's picture

Should have said that up front.

Rules

Group organizers

Group categories

Categories

Group notifications

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