Set Data Fails For Taxonomy reference field

Created on 24 December 2023, 9 months ago

Problem/Motivation

When a node of type "inspection_request" is saved, I want "field_project_name" (of type taxonomy term reference) to point to the same term as the node creator's "field_project" (also a taxonomy term reference).

In simple words, when an author creates a node I want the node's project to be set to the author's project.

Steps to reproduce

Configure rules as per the attached file.
Event:
Before saving a content item entity of type Inspection Request
Conditions:
Entity is of bundle (entity: node, type: node, bundle: inspection_request)
Actions:
Fetch entity by id (this fetches the author's user entity)
Get access to user fields (from the Rules User Fields Module - I had to include this to access the user's custom fields)
Fetch entity by id (this fetches the taxonomy term entity - output is project_fetched )
Set a data value (data: node.field_project_name, value: project_fetched)

RESULT:
502 Bad Gateway
No log entries.

I tried changing the "data" field in "Set data value" to: node.field_project_name.entity, at which point I get this error.

Drupal\Core\Entity\EntityStorageException: The parent property is not a list or a complex structure at 'field_project_name.entity'. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /home/vol4_4/iceiy.com/icei_35594463/htdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Any advice is appreciated! Feels like a bug to me.

💬 Support request
Status

Active

Component

Rules Core

Created by

🇪🇬Egypt ShErbO

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024