0

I have a rule set up that redirects the user to a specific page after they edit a node. I have another rule that changes the value in a node, then redirects to a different page. My problem: because the second rule makes a change to a node, the first rule is triggered and the user is sent to the first rule's URL (instead of the second rule's URL.)

When two or more URL redirects are triggered by rules, which one is performed? Does this change if a rule is triggered within another rule? How can I fix my problem?

3

try changing the order (weight) of each rule under its settings:

Weight

Order rules that react on the same event. Rules with a higher weight are evaluated after rules with less weight.

EDIT: it's a little convoluted, but you could create a temporary variable within the node to control things - for example, a hidden boolean field or flag that is changed to true when editing - the rule checks for this as a Data Comparison in a condition. Have the change field and redirect Rule set the boolean but not redirect, then create two rules on save - one if the field is set, and one if the field is not. For the rule if the field is set, then add an action that resets the fields value.

4
  • I gave that one a try, it did not change a thing. I'm thinking that the node saving is the last thing to happen anyway, so it is unaffected by weight. – Hoytman Jun 4 '14 at 12:08
  • 1
    it's a little convoluted, but you could create a temporary variable within the node to control things - for example, a hidden boolean field that is changed to true when editing - the rule checks for this as a Data Comparison in a condition. Have the change field and redirect Rule set the boolean but not redirect, then create two rules on save - one if the field is set, and one if the field is not. For the rule if the field is set, then add an action that resets the fields value. – Geoff Jun 4 '14 at 12:35
  • I just noticed - you could also look into Conditional Rules (drupal.org/project/rules_conditional) to accomplish the same thing without needing two different rules for the save. – Geoff Jun 4 '14 at 12:47
  • I eventually went with a flag that served as an extra variable. I am currently using conditional rules. Could you edit you answer to include the 'extra variable/flag' concept? – Hoytman Jun 4 '14 at 13:15
0

This is what I learned about rules and saved content:

Rules will temporarily save all changes that you make to a node, then save them all after the last action of a rule is performed. Because of this, the node will normally be saved after a rule is 'completed.' You can override this by calling the "Save Entity" action, which saves the entity right then.

Because the node is saved last, any rules that are triggered by the save will normally happen after the rule that triggers it has ended.

This can be changed by using the "Save Entity" action.

Your Answer

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

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