Rule to autopopulate node reference field and redirect after content creation I'm trying to make a rule so that when a node of content type X is created, a node of content type Y is also created and is automatically populated with a nodereference field to the nid of content type X that was created. Then the user should be redirected to the edit form of the node of content type Y that they just created.

My rules configuration looks like this right now:

Event: After saving new content

Condition: Content is of type X

Actions: 


Create a new entity of content type Y
Set a data value: set the node reference field on new node of content type Y nid of new node of content type X
Page redirect: URL: [entity-created:edit-url]


Everything works as expected except the redirect (which I thought would be the easiest part). Both nodes get created and the node reference field is set correctly. But I get a page not found error with the following messages:


  Notice: Undefined property: stdClass::$nid in node_tokens() (line 112
  of /web/xxxxxx/www/modules/node/node.tokens.inc).
  
  "content type X" "title of new content of type x" was successfully created
  
  The requested page "/node//edit" could not be found.


I've also tried node/[entity-created:nid]/edit for the page redirect. Same exact problem. I have no idea why it's not plugging in the nid of the new node of content type Y in between node/*/edit.
Basically you need to create another event right after "create entity" which immediately saves the new entity before you move on to the redirect rule.

See also http://groups.drupal.org/node/204558#comment-688188.