- Issue created by @gaelicmichael
- π©πͺGermany jurgenhaas Gottmadingen
The "List users" action provides a list of entities. That's the list of users in your case. If such a list action is followed by an Trigger a custom event (entity-aware) action, it will trigger that custom event once for every entity in that list and forward that entity (i.e. the user) to that event. The token name is
entity
for the receiving event.In addition to that, you want to forward the new node to that custom event as well. You can provide the token name
node
in the field "Tokens to forward" in the trigger custom event action. Just provide the token name, without brackets.With that, the custom event X1 receives 2 tokens:
entity
contains the user, andnode
contains the node entity.You can then use those 2 tokens to send the email containing values from those tokens.
- πΊπΈUnited States gaelicmichael
Thanks very much for your response. I'll try this and let you know if it works -- although I may need to ask follow-up questions.
- π©πͺGermany jurgenhaas Gottmadingen
That's great @gaelicmichael
Please set the issue status to fixed when this is working.
Follow-up questions are often worth a new issue, not only such that other users can easier find them when they have similar ones.
- πΊπΈUnited States gaelicmichael
It's taken me a while to get to the point of trying to make this work, but I've followed guidance as best as I could, and I can't get it working.
I know that the Event and Conditions are triggering, because if I just send a single email to myself, it works. It breaks down somewhere thereafter, however.
Here is a list of the linear chain of Actions in the initial sequence, as well as the Event Listener (marked with a '+') that should be triggered by the Custom Event. What am I missing?
...
- ACTION - USER: SWITCH CURRENT ACCOUNT "Switch to User 1"
- User ID: 1
- ACTION - VIEWS: EXECUTE QUERY "List Pubs Committee Members"
- Name of token: userlist
- View: People
- Display: view_users_pubs_committee
- ACTION - TRIGGER A CUSTOM EVENT (ENTITY) "Trigger Event ..."
- Event ID: app_email_pubs_committee
- Tokens to forward: node
- Entity: userlist+ EVENT: ECA CUSTOM EVENT (Entity-aware) "Listen to email Trigger"
- Event ID: app_email_pubs_committee
- ACTION: SEND MAIL "Email Committee Member"
- Recipient email address: [entity:mail]
- Subject: HCHS / SOL Pubs Cmte email review for the abstract related to [node:field_ab_abbr_title]
- Replace tokens: yes
- Message: ...I have ensured that the display ID view_users_pubs_committee is what is shown in the View configuration at Advanced > Other > Machine name.
- π©πͺGermany jurgenhaas Gottmadingen
I guess this is the time where exporting the model and uploading it for review may be better for review and bug hunting.
- πΊπΈUnited States gaelicmichael
Sure -- here is the export file.
FYI, there is an Action in the Custom Event trigger sequence that I've bypassed and thus should not be active.
- π©πͺGermany jurgenhaas Gottmadingen
I'm confused how that filename
eca-email-all-pubs-committee.tar.gz
comes from. ECA is exporting asbpmn_io-process_wgaz9kq.tar.gz
. But that's just an aside.The model itself has a simple mistake: the "Trigger Custom Event" action uses the Trigger a custom event action but the event is ECA custom event (entity-aware).
Note, there are custom events, and there are entity aware custom events. The action to trigger the event should be of the same type.
And then you should use the Debugging techniques, that will show you which tokens are available at which point while processing the model. If a token that you expect is missing, then you have some indication on what needs to be done to fix that.
- πΊπΈUnited States gaelicmichael
Thank you for looking at the model.
I was unaware of different kinds of Custom Events. Where is "Entity-Aware" and the distinction between event types explained?
- π©πͺGermany jurgenhaas Gottmadingen
Where is "Entity-Aware" and the distinction between Custom Event types explained?
I don't know if it's explained anywhere. But there is ECA custom event (entity-aware) and there is ECA custom event. And for each of these there are action plugins to trigger those. It's likely that this was explained in one of the videos in ECA TV.
- πΊπΈUnited States gaelicmichael
I can confirm that changing the Action to be entity aware does indeed fix the problem. Thanks for pointing that out, although some clear explanation of this issue is needed on the website.
There is one further issue on which I would appreciate guidance. After the Event listener gets triggered by the Custom Event, but before the email Action, I'd like to have an Action that does a
LOAD VIA REFERENCE
, so that I can access the fields in a Content Item referred to in thefield_manuscript_number
field in the tokennode
(which I know is being passed properly to the Triggered action).I tried to configure the Action as follows, but it does not work. I assume that the
Load entity from
setting is the problem. Given that this is an Action that is getting fired asynchronously, and maybe not be in the same context (??), I assumed that the setting should be set toDefined by token
, but that doesn't work. Neither doesCurrent scope
. What should the settings be?- ACTION - LOAD VIA REFERENCE "Load Biblio Item"
- Name of token: biblio
- Field name entity reference: field_manuscript_number
- Load entity from: Defined by token
- Entity type: Content
- Load latest revision: yes
- Entity: nodeThank you
- π©πͺGermany jurgenhaas Gottmadingen
although some clear explanation of this issue is needed on the website.
You mean the ECA Guide? Contributions welcome.
Load entity from: Defined by token
Have you noticed the description below that field? I'm sure that settings is not what you want.
- πΊπΈUnited States gaelicmichael
Yes, I have seen and noticed 'When using the "
Defined by token
" option, make sure there is a token with this name:eca_token_load_entity_ref_from
' .Is this what I need in principle but I need to rename the
token
node aseca_token_load_entity_ref_from
? Or do I need a different setting on the configuration ofLoad entity from
? I don't see any information about this use case anywhere.The ECA module is a really useful and versatile tool for enhancing functionality, but like much in the Drupal world, in desperate need of well-written documentation. After I get the functionality of my prototypes working, I do intend on writing something up for other people trying to figure it out.
Thank you
- π©πͺGermany jurgenhaas Gottmadingen
I'm not sure that even more documentation would have avoided this conversation. Like for example, how could we make it more prominent that the token
eca_token_load_entity_ref_from
is required when using that option?Yes, we need more documentation and a few people are constantly working on the ECA Guide. If you have a demand for more, maybe you can fund more resources to make that happen more quickly.
And no, the mode you need is not
Defined by token
. That mode means that a token defines which mode you want to use.Why don't you just load from the
Current scope
like you've done before? - πΊπΈUnited States gaelicmichael
Because it doesn't work, it triggers the error indicated by this excerpt from the error log:
Failed execution of Load Biblio item (Activity_1v2twte) from ECA Abstract / Presesentation Proposal: Pending Review (process_wgaz9kq) for event eca.content_entity.custom: Field field_manuscript_number does not exist for entity type node/hchs_abstract_presentation..\n\n#0 /var/www/html/testhchs/modules/contrib/eca/modules/content/src/Plugin/Action/LoadEntity.php(56): Drupal\eca_content\Plugin\Action\LoadEntityRef->doLoadEntity() #1 /var/www/html/testhchs/modules/contrib/eca/src/Entity/Objects/EcaAction.php(103): Drupal\eca_content\Plugin\Action\LoadEntity->access() #2 /var/www/html/testhchs/modules/contrib/eca/src/Processor.php(298): Drupal\eca\Entity\Objects\EcaAction->execute() #3