Question about Views relationship to Set Value

Created on 8 May 2023, over 1 year ago
Updated 10 May 2023, over 1 year ago

Problem/Motivation

I just got a question that maybe, related to this issue -> https://www.drupal.org/project/eca_vbo/issues/3357271 💬 Bulk changing field values via ECA VBO Fixed

I tried to work with Views that has relationship. Below is the Token I put to display and it display correctly via ECA :

[entity:field_paragraph_info:entity:field_amt:value]

When I work with "Entity: Set Field Value", At first, I tried to put Token value above into "Field name", not work.

So, I tried below:

Field name = field_amt
entity = entity:field_paragraph_info:entity

Then, it works as I expected.

My question is is this the way I should do? I just afraid that in the future update, something might be changed here.

Thank you,

💬 Support request
Status

Fixed

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @abx
  • 🇩🇪Germany mxh Offenburg

    A more straight forward way is to use action "Entity: load via reference", with that you can store the referenced entity into another token, then finally use "Entity: Set Field Value" action using the token name holding the referenced entity in "Entity".

  • Just tried Entity: load via reference which is also work great. But I found a problem when working with multiple paragraphs and relationship. When I tried to set value using ECA VBO, the first paragraph is always set. Even though the row I selected in Views is second paragraph. Is there anyway to make it work?

    Thank you,

  • 🇩🇪Germany mxh Offenburg

    I don't know. Maybe you have a view of nodes using paragraphs as relationships?

    If you'd want to operate on the paragraphs instead, then I'd recommend to create a view listing paragraphs instead ,i.e. use paragraphs as base table in the Views configuration.

    Other pointers that may nor may not help you:

    • When you want to get all references of an entity reference field and store them in one token, use "Entity: get field value" instead of "Entity: load via reference". The latter one is basically only loading one entity, where "get field value" is capable of loading the whole list.
  • Status changed to Fixed over 1 year ago
  • Yes, you are right, I have a view of nodes using paragraphs as relationships. I then, tried to use paragraphs as a base table and ran into a bug in Entity Reference Revisions ( https://www.drupal.org/project/entity_reference_revisions/issues/2799479 🐛 Views doesn't recognize relationship to host Needs work ). If I remember correctly, this is the reason I always created Views using node (content) as the base table all the time.

    Anyway, when create a new Views using paragraphs as a base table, it works now.

    Regarding, "Entity: get field value" and "Entity: load via reference", this is good, I'm sure I will need it soon since I plan to use ECA to replace many of my work flow.

    Thank you mxh,

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024