Drupal Association members fund grants that make connections all over the world.
Setting entity properties, or more commonly, filling in field values, is a very common use.
Values will need to be available, so read Data availability first.
This works on all data types, such as populating fields on entities, setting values in user profiles, entering a value in a form, etc.
* Creating a node and filling in field values.
* Set a manually entered value
* Populate an entity reference field
* Change a user account name
* Changing a user's theme
How to update different content types - with entity reference
You have two content types (Type_A and Type_B) and they are related by an entity reference field. eg. Type_B has an entity reference field to it's parent node of Type_A.
When Type_B is updated you want Type_A to be updated as well. This can't be solved in a single rule for Type_B, because Type_A has different fields and they are not available via the data selector.
The trick is to make a Component Rule for updating Type_A and then call the component via an action on the Type_B event.
- Make a new Component Rule named "Update referenced entity"
- Add a parameter of type Node, machine name "referenced_entity"
- Save and continue editing.
- Add a new condition that content is of type "Type_A" (this gives access to Type_A's fields)
- As an action, set a data value to update a field in Type_A.
- Save the component.
- Return to your rule for Type_B events.
- As an action choose the "Update referenced entity" component you just made.
- For the input select the referenced entity field on Type_B.
- Save the rule and test.
To make the above example more useful, you might include additional parameters for your component so that you can pass in values from Type_B and have them used on Type_A. Although at the time of writing there appears to be a bug in accessing text input parameters via tokens/data-selector. See http://drupal.org/node/1547160