How to add a node to the same group as a referenced node, using Business Rules

Using the groups module, my goal is to use Business Rules in order to automatically add a node to the same group as another node that is referenced using an entity reference field). The setup is as follows:

Node type project (is group content, has group field)
Node type page (is group content, has group field)
Group (has project and page nodes plugins enabled)

A page has an entity reference field that can reference a project.

When saving a page (either new or existing) I want the page to be added to the same group as the project.
For now assume that each project is part of only one group.

Using Business Rules:


  • project variable
  • group variable
    1- Fetch project by ID (node:field_project:entity:nid) THIS WORKS
    2- Fetch group ID {{project_variable->entitygroupfield:0}} THIS DOES NOT WORK
    3- Add node entity to a group DIDNT GET TO THIS BECAUSE OF ACTION 2 NOT WORKING

The project ID is correctly fetched, but the group ID is not found.

It probably is because the context is not present of the group of which the project is part of, but I don’t know how to add that.