I have two problems:
1) How to "Load a referenced Node" as in D6 (I do not see the option)
2) Why can't I auto-populate a node referenced field into the term reference field on the same content type upon saving?

FIRST Issue
I would simply like to use D7 Rules to auto-populate my term reference and user reference fields like I did in D6. My attached image shows my Rule in D6.

In D6, I used the "Load a referenced node" option...

Let's say I have two content types, A & B

In content type A, I have term XYZ saved

Upon saving Content Type B, I want to auto-populate the term field as XYZ. But I can't do this because I don't see an option to Load a referenced Node like there was in the D6 version. What criteria would I set to apply my node reference field in Content type B so that I can reference other field tokens from Content Type A?

SECOND Issue
If, on the other hand, I simply want to grab the Node Reference field in the same content type and auto-populate that into my term field (again, same content type), i can't even do that!

On Content Type B, I have two fields:
a node reference to Content Type A called 'field_node_ref'
a term reference called 'field_term_ref'

Upon saving Content Type B, I simply want to auto-populate the 'field_term_ref' field with 'field_node_ref' field.

RULE

Event: After Saving New Content Type

Action: Set a new data value
selected data = node:field-term-ref:name (NAME)
And then set my token value to: [node:field-node-ref]

But upon saving new content in Content Type B, the [node:field-term-ref] is not auto-populating from [node:field-node-ref]

If, instead I use:
selected data = node:field-term-ref (TERM)
I do not see the option to add node:field-node-ref.

Thank you, kindly!

CommentFileSizeAuthor
rules example drupal 6.jpg24.61 KBcalefilm

Comments

calefilm created an issue. See original summary.

calefilm’s picture

Title: Set data field (D6 was so easy) » Set data field using node reference (D6 was so easy)

edited title

calefilm’s picture

Issue summary: View changes
calefilm’s picture

Status: Active » Fixed

Solution to both problems:

1) fixed here: http://drupal.stackexchange.com/questions/219743/how-to-entity-reference..., with available Rules Export for anyone trying to do the same thing.

2) I realized that I CANNOT reference a node reference name into a term reference name. I needed to reference a term ID into a term ID field, which is what i accomplished in my solution.

EVENT After saving new content of Car Review

CONDITION
Entity has field
data selector: node:field-car-review-node-reference
value: field_car_model_tag

ACTION
Fetch Entity by ID
value: node
data selector: node:field-car-review-node-reference:nid

Set a data value:
selected data (that i want to change): node:field-car-review-node-reference:field-car-model-tag

Export

{ "rules_term_ref_4" : {
"LABEL" : "TERM REF 4",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : {
  "node_insert--car_review" : { "bundle" : "car_review" },
  "node_update--car_review" : { "bundle" : "car_review" }
},
"IF" : [
  { "entity_has_field" : {
      "entity" : [ "node:field-car-review-node-reference" ],
      "field" : "field_car_model_tag"
    }
  }
],
"DO" : [
  { "entity_fetch" : {
      "USING" : { "type" : "node", "id" : [ "node:field-car-review-node-reference:nid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "data_set" : {
      "data" : [ "node:field-car-review-tag" ],
      "value" : [ "node:field-car-review-node-reference:field-car-model-tag" ]
    }
  }
]
}
}

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.