Entity: set field value using tokens

Created on 6 November 2023, about 1 year ago
Updated 5 January 2024, 11 months ago

Problem/Motivation

I am trying to set a field value, using tokens from other fields.
Indicating the field name (I am using a token) as well as adding the field values with tokens I understand.

However, the last value, Entity (provide the token name of the entity that this action should operate with), I don't understand. Sound like doubling with the field name? What is the token name of the entity?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Fixed

Version

1.1

Component

Documentation

Created by

πŸ‡³πŸ‡±Netherlands jandewit6

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

Comments & Activities

  • Issue created by @jandewit6
  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    What is the entity you want to set the field on?

    field name: name of the field
    entity: entity with that field
    value: value to set

  • πŸ‡³πŸ‡±Netherlands jandewit6

    Thanks.
    That was my thought too, the content type. So I took [node:content-type:locatie]

    Here's the complete setup:

    Method: set only when empty
    Strip tags: no
    Trim: no
    Field name: [node:field_volledig_adres]
    Save entity: yes
    Field value: [node:field_straatnaam:value] [node:field_huisnummer:value]
    Entity: [node:content-type:locatie]

    The tokens I took from /admin/help/token

  • πŸ‡³πŸ‡±Netherlands jandewit6

    Got it going.

    The token value is [field_volledig_adres] instead of [node:field_volledig_adres]

    Wonder why /admin/help/token is giving me this token value then.

    I forgot to mention this before: thank you for this very exciting module. Great work, very welcome addition to the Drupal experience!

  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    Yes, it can be confusing, which syntax to use where. Mine would look like this:

    Method: set only when empty
    Strip tags: no
    Trim: no
    Field name: field_volledig_adres
    Save entity: yes
    Field value: [node:field_straatnaam:value] [node:field_huisnummer:value]
    Entity: [node:content-type:locatie]

    ... if you had another token set to the correct entity you want to set field_volledig_adres on, you would use that without square brackets for Entity.

    The token browser lets you see what tokens are available on each entity type -- but the first part of that token needs to be replaced with the actual token you want to operate on. Many events do create a "node" token for you -- almost all create an "entity" token plus a token with the entity type id.

    I highly recommend reading https://ecaguide.org/eca/concepts/tokens/ , and the other docs there, it will help you come up to speed quickly...

  • Status changed to Fixed 11 months ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024