Bulk changing field values via ECA VBO

Created on 29 April 2023, about 1 year ago
Updated 1 May 2023, about 1 year ago

Problem/Motivation

I've managed to set up the module as described in the readme file. But I am unable to configure it properly.

Steps to reproduce

What I would like to do in a list of commerce product entities is this:

  1. get the value of {field_date} from the entities listed / selected in VBO,
  2. make some alterations on that field (with ECA tamper),
  3. and resave the new value within the commerce product entity.

Proposed resolution

What I have done so far:
1. Set up the VBO: Execute Views bulk operation (multiple at once) and the VBO: Custom access for Views bulk operation events. Works as expected.
2. I see the [event:queue] token which provides an array of the relevant information regarding the entities involved.

Remaining tasks

What I would like to know: from the [event:queue] listing the entities selected via VBO, how can I dig down to the {field_date} value to manipulate that data value.

Thanks everyone for any helpful idea.

💬 Support request
Status

Fixed

Version

1.0

Component

Documentation

Created by

🇮🇪Ireland marksmith

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

Comments & Activities

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

    Your use case doesn't require using the multiple at once event. Use "VBO: Execute Views bulk operation (one by one)" instead, this should enable you to directly access one entity at a time without the need for a loop. From there on, you should be able to access the main entity of the view row using the [entity] token, e.g. [entity:field_date:value] should be available.

  • 🇮🇪Ireland marksmith

    Thank you for the quick tip! It's a working solution. A quick repro of how it works (for others, like me, searching):

    1. Add VBO Execute views bulk op (one-by-one) event and the VBO access event (as per readme.md)
    2. Load entity action: Load entity from type and ID (in my case commerce Product, ID is: [event:entity:id]) - assigned token name: product_entity
    3. Entity Get field value action - field name: field_date - assigned token name: current_date_value - Entity: [product_entity] (as established above)
    4. Field value is now available and I was able to tamper it according to my needs.

    Thanks's again for the excellent support!

  • Status changed to Fixed about 1 year ago
  • 🇩🇪Germany mxh Offenburg

    Great to hear that it works, thanks.

  • 🇮🇪Ireland marksmith

    Thanks again. I have further tailored the script, here's what I found.

    Load entity action is, indeed, not necessary. However:

    1. If I choose the "Display a message to the user" action to display the value of the field_date field, the right token to be inserted in the Message section is [entity:field_date:value], as you suggested.
    2. If I choose the "Get field value" action (or Set field value, for that matter), the token above did not work. I needed to insert only field_date in the Field name (without the brackets).
    3. The ECA tamper (used for the Convert date to timestamp action) also uses the tokenized variant in its Data field[entity:field_date:value].

    A bit confusing to follow when tokens should be used and when not, but it works, nonetheless.

    Thank you for these excellent modules!

  • 🇩🇪Germany mxh Offenburg

    We're planning to improve that confusion when to just specify a token name only and when to use a token.

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

Production build 0.69.0 2024