0

I have a content type called "article" and an entity type called "article 2", they both have identical fields.

When I create an article node and save it I want a rule to fire that then basically creates an exact copy of this as an entity, article 2. then deleted the original node after that. So I am left with a copy of the node as an entity - all fields etc, and no node.

I can get rules to create an entity quite easily by using "Create a new entity" but I can't seem to map the fields from node to entity?

0

Wonders never cease, managed to figure this out. For anyone else:

  • Created a Rule

EVENTS:

After saving new content of type Article

CONDITIONS:

  1. Entity has a field:

Data selector: node

Field: added ONE field from my source node (one seems to be enough) This was called "discipline" in my case. node:field:discipline

  1. Entity is of bundle:

Data selector: node

ENTITY BUNDLE: Article

(so this is my source node again, my original node I am copying from)

ACTIONS: (this is where we create the entity using the information from the node)

  1. Create a new entity:

ENTITY TYPE:

Article CLONE (this is my entity "content type" name, to make it simple)

  1. Set a data value:

Selected data: entity-created:field-discipline (this is the identical field on my newly created entity that I want to add data to.

Data selector: node:field:discipline (this is the field from the node I want to copy to my entity identical field)

  1. Delete entity:node

3rd step deletes the original node that was created. You can add more "set data values" as you'll need one for each field you are copying over.

This works fine. There could be better ways to do this, of course. Hope this helps someone else.

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.