How to access values in Content Item pointed to by reference entity field?

Created on 14 February 2025, 16 days ago

Problem/Motivation

This is a really basic question but I cannot find clear, explicit information and have tried numerous experiments to try to make this work.

I have a Content Type I'll call CT-A which has a Reference Entity field I will call field_cta_re that holds a value that points to another Content Type that I will call CT-B. The CT-B Content Type has a text field I will call field_ctb_text.

I am trying to create a model whose Event is triggered by the insertion of a new CT-A Content Item. The Action will be to send out an email that includes the text in the field_ctb_text field.

In the text of the email in the Action that is triggered by a new CT-A Content Item, I have tried using [node:field_cta_re:field_ctb_text], and that remains blank. I have also tried formatting it as [node:field_cta_re.field_ctb_text] (using a period rather than colon to dereference the pointer) but that is also blank.

I have also tried creating an ENTITY: LOAD REFERENCE Action (with parameters I can only guess because the documentation is so vague), but that hasn't worked either.

Can I please get some clear guidance on how this is supposed to work?

Thank you

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Active

Version

2.1

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States gaelicmichael

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

Comments & Activities

  • Issue created by @gaelicmichael
  • πŸ‡ΊπŸ‡ΈUnited States gaelicmichael

    And as a side-note, I can't get even the value in a CT-specific field of the triggering node ("entity") to appear in the email.

    The value [node:title] does get rendered... but not [node:field_my_custom_name]. Why??

    Clear, explicit examples in documentation would be welcome.

  • πŸ‡ΊπŸ‡ΈUnited States gaelicmichael

    In fact, I've just determined that the problem must just be the use of tokens.

    The ENTITY: LOAD REFERENCE Action does seem to be working, but the custom fields in the loaded entity are not being rendered.

    Let's say that the token for the loaded entity is entity_ctb.

    The token [entity_ctb:title] does work but [entity_ctb:field_ctb_text] does not. Why? This ought to be simple.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Have you tried the token browser for the correct syntax of the token? That browser is available below the property panel in the bpmn_io UI if you have the token module installed and enabled (which is optional).

    In that browser you can not only see what fields are available for each entity type but also the correct syntax. Often, the syntax depends upon the used field type, so e.g. the syntax for your example could probably be something like [entity_ctb:field_ctb_text:value], but I can't tell for sure as it really depends on the data structure for each field.

  • πŸ‡ΊπŸ‡ΈUnited States gaelicmichael

    I don't see any reference to a Token Browser on the Property Panel on the bpmn_io UI.

    I have enabled all of the ECA modules that were installed by default. I do not see any mention of a Token Browser on this page:
    https://www.drupal.org/project/eca/ β†’

    Can you please be more specific?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    It's a different module: Token β†’

    When you install and enable that, you get a link to the token browser. And if you want to know more about tokens in ECA. then this page is certainly interesting: https://ecaguide.org/eca/concepts/tokens/

  • πŸ‡ΊπŸ‡ΈUnited States gaelicmichael

    It is working now and the only thing that I changed was installing the Token module. This suggests that, contrary to the documentation, the Token module is actually required for the normal functionality to work.

    I did read that webpage https://ecaguide.org/eca/concepts/tokens/ and did not find it very satisfying. It is not always clear and it is not complete. It is not sufficient to only discuss trivial examples, like the use of the title and mail fields. In real world settings, people are going to want to use the fields defined in their own Content Types.

    In order to be useful, the documentation needs to discuss somewhere, whether on this page or another:

    • How to use and refer to fields in custom Content Types, with real and non-trivial examples.
    • How to access the fields in a Content Item that is referred to by an Entity Reference field (i.e., need to use the ENTITY: LOAD REFERENCE Action). Again, non-trivial and real world examples with clear explanations are needed.


    I'm sorry if I sound frustrated, but I've spent two weeks trying to get ECA modules to work that should have been possible in less than a day.

  • πŸ‡ΊπŸ‡ΈUnited States gaelicmichael
Production build 0.71.5 2024