ECA / Automator integration not working as expected

Created on 19 April 2025, 24 days ago

Problem/Motivation

Hi all, I have been using the ECA / AI Automator alliance with recently trigger an AI Automator which is tied to a particular Long text field in a node entity. Basic usage.

My ECA model responds to a node update event, the Automator is called, and everything work robustly and reliably - the node ID used by the Automator is simply being picked up form the magic one 'implied' by ECA Update event - the good old [entity] equivalent which never needs to be said explicitly.

It just works.

HOWEVER, I seem to be having trouble when I want to the trigger THE SAME Automator on a specified node ID which this time, from an ECA that responds to a path (URL) request.

I have set up another ECA which uses an ECA Endpoint event to respond to /eca/node/automark?nid=NNN.

I then pick of the node ID from the query string and stuff it in token which I named: targeted_id.

I know for sure that all this works because I have debugged the life out of it!

So, to my mind, the next step is to simply call the AI Automator from within my which on the face of it look trivial, as I understand it, I should simply need to 'send over' the NID I'm interested in as illustrated on the screenshot below.

(I appreciate that a screenshot only tells what it shows but it seems like the clearest way to illustrate the scenario and I can assure any reader that the gabbing of the nid from the query string part all works perfectly.)

When I trigger this second ECA model into action by visiting the URL, all seems well and then I hit a WSD.
Digging into that reveals...

[19-Apr-2025 11:48:38 UTC] Uncaught PHP Exception Error: "Call to a member function getEntityTypeId() on null" at C:\Users\nick\Sites\bit-by-bit.org\public_html\modules\contrib\ai\modules\ai_eca\src\Plugin\Action\AiAutomatorRule.php line 77

This is telling me that the AI Automator is not receiving the NID.

So, in summary, what I am asking for here in terms of support is simple - is my thinking and my pattern of use correct, and might this actually be a issue to raise on the AI ECA Automator sub-module instead?

Thanks all

💬 Support request
Status

Active

Version

2.1

Component

Miscellaneous

Created by

🇬🇧United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • 🇬🇧United Kingdom SirClickALot Somerset
  • 🇩🇪Germany jurgenhaas Gottmadingen

    When I look at the screenshot, the field Entity wants to receive an entity, not an entity ID. So, you need to use the ID you have, load the correct entity with it into another token, and then provide that token containing the entity to the automator plugin.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Thankyou @jurgenhaas,

    That has really helped, it was driving us mad.

    We still really struggle to recognise when an entity is needed over and entity_id.

    HOWEVER, attempts to do an Entity: load on the 'targeted_id' token fail miserably whatever we try!

    HARD CODING the actual (known) ID as step (4) works a treat and calls the AI Automator, does the job, and returns back with a confirmation all beautifully via AJAX, exactly as we want, but is of course useless to us ;-)

    We just don't get it and believe me, we have put the time in experimenting with all manner of combinations of:

    1. Current scope
    2. Type and ID (see below)
    3. Type and properties (see below)
    4. Defined by token

    Is there most-commonly-used recommendation?

    Almost there!

  • 🇩🇪Germany jurgenhaas Gottmadingen

    If you want a string value, e.g. in the field "Entity ID" to contain a token that will be replaced with it's value during runtime, then you have to use the token syntax i.e. [targeted_id]. In other fields, like "Entity" in the Automator action, the field explicitly asks for a "Token name", then you should only provide the name and not use replaceable token syntax. All this is described in the token chapter of the ECA Guide.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Absolutely!

    I have read and understood the Token section of the guide many moons a go and been using it for years now too not mixing up [token] with token.

    That's not the issue here that is the finally stumbling point, thanks to your last response, it is now now clear the Automator needs an entity not an id but the problem we are hitting is LOADing that entity in in order to be able to pass it forward.

    To clarify, the illustration above in #4 is the Entity: load dialogue and if we load it via a hard-coded id (8797) it all work perfectly and that confirms your advice about passing on an entity that we have successfully loaded.

    The problem is we simply cannot seems to get the right combination to load it!

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is either a permission issue or the token doesn't contain the ID as expected. Time for debugging and reviewing the logs.

  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024