How to use rules with a Node Reference?

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

I'm trying to use a rule so that after Content B is newly created, that the rule triggers and the person is re-directed back to the url of the node that they just created has a reference to. Essentially, I want the rule to follow the node reference that I have already loaded into the node with the prepopulate module, back to the node it references.

I presume this functionality exists with the "Load a referenced node" feature. However, none of the rules that I have created so far work as desired, so I thought I'd check if others have had success with this method. Am I missing a step, like adding a custom url redirect to the bottom of my rule? In which case, what exactly does "load a referenced node" even do?

Comments

Related issue in the issue

robertdouglass's picture

Related issue in the issue queue: http://drupal.org/node/374155

The "load" action makes the

fago's picture

The "load" action makes the node available as variable to rules - so you can use any other node related action with it. It's not about printing the node or so. To do so best add a redirect action and redirect to "node/id". You can get the id e.g. by loading the node and then using the [referenced_node:nid] replacement pattern provided by the token module.

url appends instead overriding

Ariesto's picture

Thanks for the response above Fago, sorry I've been out of the loop the past few days.

Implementing your solution half-worked, but I'm still left with the problem I posted in this post:

http://drupal.org/node/374459

Specifically, the url appends instead of overriding.

checkmarking both boxes "redirect" and "override another path" results in:

       ?q=node/61&=node/44

checkmarking only the "override path" results in:

       ?q=node/62&=node/44

checkmarking only the redirect box results in:

       ?=%3F%3Dnode/44

checkmarking no boxes results in:

       ?=%3F%3Dnode/44

Could the prepopulate module be involved, or am I way off track?

Thanks for your help. I will make documentation for this after the above mystery is solved.

A variation on this theame

VeeLin's picture

Hello,

Not sure if I would start a new discussion or add here . . . I'm trying to enforce a one to one relationship between a node and a referenced node using rules. So this is what I want to do:

User creates node A
from node A user can create related content Node B

If node A has a Node B then
when user selects to create new node B they get re-directed to existing node B. (Ideally)
Alternately they can get a warning.

I read about a similar case for limiting comments but am not sure how to do it for nodes . . . any suggestions would be greatly appreciated.

Thanks,

V

Rules

Group organizers

Group categories

Categories

Group notifications

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