0

Since I'm not a coder I'm using the Rules module to automatically create a node of type B when a user creates a node of type A. That works. I used 'create new entity' of 'type B' 'after saving new content of type A'. It also sets a unique name for the title of the newly dynamically created entity. And that's works great. In addition, I've also set the author of the 'entity-created' to a 'generic author' by simply using a specific uid (I just used a specific number as the value so they will always have the same author, that's fine).

So this all works. In my next step of actions I want to fill in the entity reference field in the node created of content type A with the title of the 'entity-created' of type B. And here's where I'm stuck.

I tried: set data value: node:field-entityref:title new value for the specified data: [entity-created:title] (that should be different from the [node-created:title]) But that doesn't work. I tried many different things as well but it seems that I can't grab that title of that new entity that was dynamically created by Rules. I tried to 'fetch entity by property' but that also doesn't fill in the title in my entity reference field on the node of type A. I don't know why. I hope someone can help me out in my last step. Cheers!

1 Answer 1

2

All is well. It works. (finally) I had to recreate my sandbox site and it worked. I installed only the necessary modules. So beneath the steps in my rule.

  1. After saving new content of type 'story'
  2. Create a new entity Parameter: Entity type: Node, Content type: article, Title: article related to nid..., Author: 2 Provides variables: Created article (article_created)
  3. Save entity Parameter: Entity: [article-created], Force saving immediately: true
  4. Set a data value Parameter: Data: [node:field-myref], Value: [article-created]

(if I didn't have the action 'save entity' it would override the node that was originally used as the default setting in the reference field on the management of the story content type, just so you'd know)

So what was the problem? I'm not sure, it was probably a conflict with a certain module. I was thinking of the 'clone module'.

Your Answer

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

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