I have a node that has a node reference to another content type. What I want is to update the referenced node field value on updating the node;
Let me clarify the issue.
For example I have a node of type "Basic Page" which having a relationship to a node of type "Article". I want to sync fields in two node let say I have a name field(Text) in both nodes. On updating basic page node I want to populate the referenced node Name field with that of the value in the basic page node Name field. How can I do that?
This is what I have done so far:
- Event - After updating existing content.
- Condition - Content is of type Basic page.
- Action - Fetch entity by id(id from the entity reference field).
- Action - Set a data value .
I am stuck at the fourth step I can't select the name field of the entity fetched in the data selector.
How can I populate the referenced node field with the value of the blog page node field?
Note: This is just for example In real case I want to map multiple fields from one node to another.
This is the exported rule:
{ "rules_on_updating_basic_page_nodes" : {
"LABEL" : "On updating Basic Page nodes",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update" : [] },
"IF" : [
{ "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "page" : "page" } } } }
],
"DO" : [
{ "entity_fetch" : {
"USING" : { "type" : "node", "id" : [ "node:field-article:nid" ] },
"PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
}
}
]
}
}