How to change the referenced entity field value?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jetsonjohn's picture

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:

  1. Event - After updating existing content.
  2. Condition - Content is of type Basic page.
  3. Action - Fetch entity by id(id from the entity reference field).
  4. 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" } }
}
}
]
}
}

Rules

Group organizers

Group categories

Categories

Group notifications

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

Hot content this week