0

I am simply trying to autopopulate a Taxonomy Term from Content Type A into Content Type B.

An example, I'm creating a review site for Cars:

Content Type A = Car Model field: field_car_model_tag

Content Type B = Car Review field: field_car_review_tag

Assuming, Content Type A|CAR MODEL has already been created, titled "FORD MODEL".... My users will find and click a "Review Ford" link that routes them to Content Type B|CAR REVIEW, and auto-populates the Node Reference field (Node Reference URL Widget, for example, even though I'm attempting to only use Entity Reference fields).

After saving this same Content Type B|CAR REVIEW node, I would like this field, 'field_car_review_tag' to automatically populate with it's sister term from Content Type A|CAR MODEL.

In Drupal 6 Rules, I found this to be very straightforward.
I would simply "Load a referenced node, and then set a CCK field without validation", applying the token from the referenced content type. In Drupal 7, the settings are seemingly endless.

Thank you for your help!

1

I believe I've resolved this issue; least it looks good so far. Super thanks to Alauddin's response to "how to create rules to send email notification for node reference content?"

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, with value: node and data selector: node:field-car-review-node-reference:nid

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

I think I have this right, here is an export of my Rule:

{ "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" ]
    }
  }
]
}
}

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.