1

I can't seem to get this to work. I've searched and search, and maybe I'm not using the correct terminology, but I need to add a custom field to a Relation that reads a value from the Entity its related to. Or another way to put this, I need a field from the Relation to update a field in an Entity when the Relation is updated. Example:

Entity -> Worker
Relation -> Employed At
Entity -> Company

I want to update my custom field "classification" through the Employed At Relation and then see that change reflected in the "classification" custom field in my Worker Entity.

1 Answer 1

0

If you are talking about the Relation module, then you can use Rules to trigger entity updates whenever a relationship (which is also an entity) changes.

The workflow would be like this :

  1. Trigger on entity update.
  2. Check that entity is a relation.
  3. Update linked entity.

Check the video documentation on Relation, there are two (1, 2) of them talking about Rules.

6
  • When you say "1. Trigger on entity update", do you mean "trigger on Relation update"?
    – jhoffmcd
    Dec 13, 2012 at 5:44
  • Yes, bear in mind that a relation is an entity from drupal point of view.
    – drcelus
    Dec 13, 2012 at 6:39
  • Thanks, those videos helped get familiar with it all. I can get a the relation type I want, but not sure how to get the linked entity. For Events I have "After Updating a Relation", for Conditions I have "Data Comparison" which I use to select the correct Relation Type. This is good because it gives me access to the fields that I need from that specific Relation. I've tried a few Actions, Fetch Entity by Property or ID, but I'm hitting a wall. I think I might be missing something concerning endpoints?
    – jhoffmcd
    Dec 13, 2012 at 16:13
  • What do you mean by endpoints ?
    – drcelus
    Dec 14, 2012 at 6:56
  • Endpoints (an array I'm assuming) being the entities on either end of the Relation. Ex: Worker = endpoint[0], Company = endpoint[1]
    – jhoffmcd
    Dec 14, 2012 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.