Automatically filling field in related content type I have two similar content types on a Drupal 8 site: groups and projects. Groups can have child projects, but a project does not necessarily have a parent group. I have an entity-reference field on the Project content type, where a parent group can be added.

However, as I am setting up many different views, I would like these child projects to be added to the Groups nodes when users add parents to the Project nodes. In other words, I want to automatically update the field "Projects" on the related node of the "group" type.

How would I go about doing this? I see most people recommend showing a block on the node, but I would like to use this field in various views, so that won't work.
So if I undersand you don't have any relation Groups -> Projects? You just have a relation Projects -> Groups (that you also call parents)? .
And you want to show by views, Groups and their children (projects)?

If this is what you want you have several choices.


Add many relationships in the view advanced filters in order to reach groups projects, (could be tricky).
Add a field entity relationship Groups -> project that you programmatically set on every projects insert/update/delete. Thanks to this it would be much more easier to build a view.
create your own custom block, with your dedicated SQL query. listing all children of a group and attaching this block to all "groups" content type pages.