Set data action in referenced entity.

Created on 4 June 2019, about 5 years ago
Updated 30 October 2023, 8 months ago

One of my most common tasks I used to use rules was to modify field data of a referenced entity after saving a entity. In the most primitive case I used this for just setting a backrefernce. In more complex cases do a math-operation with values from the referencing and the referenced entity and write the result into the referenced entity.
There where plenty of ways to get there. Either you could add a condition to the rule like node:field_reference:node is of bundle to get access to the fields of the referenced nodes or you could use the module rules conditional. A other approach was using components.

None of these options seem to exist in Rules for Drupal 8. I do not really understand, why this seems not to be important to anyone then me, because 90% of my rules in D7 where used to modify datas in other entities then the one that triggers the action.

As example: there is a Contenttype called "Basked" with a integer-field "Apples" and a Contenttype "eating apples" with a reference to the basked the eaten apples are taken from an an integer-field "quantity of eaten apples". Whenever You create a node of "eating apples" I would like to perform a action to subtract the "quantity of eaten apples" from "Apples" in the basket.

Creating such a rule in D6 or D7 was a task done in 5 minutes. And in D8 it seems to be ...

...impossible...

Is there any possibility to set field values other then body and title of a refernced entity. None of my attempts seem to work, not if I fetch the entity, not if use components, not by setting the conditions.

Any help would be highly appreciated

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Rules Core

Created by

πŸ‡©πŸ‡ͺGermany semanthis

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024