- Issue created by @london6339
- 🇩🇪Germany jurgenhaas Gottmadingen
Is the paragraphs field in content A a multi value field and each of those paragraphs contains exactly 1 email field?
Or is it that each paragraph can contain many email addresses?
In any event, with the Entity: get field value you can read the paragraph field into a token. That's then either a single content entity or a list of content entities.
If it's a list, you can loop through that list. There are various techniques on how to do such a loop. The ECA Guide has samples like Views or Multi value field loop
Once you have a paragraph entity in a token, you can then do with it the same what you do with any other entity, e.g. your content A: get field value(s), i.e. the email address(es).
Hi Jürgen,
There's one email field in the paragraph that can be added an unlimited amount of times. The issue is there are other fields in that paragraph (name, email, and another text field).
I tried to load the paragraph with load entity by reference, but I only seem to be getting 1 of the many email fields when printing the stored token.
When I try to store the email field of the loaded paragraph, I also get an error:
Failed execution of Activity_1ubgy00 (Activity_1ubgy00) from ECA Send email to external/internal (process_f98b4rg) for event Drupal\eca_content\Event\ContentEntityUpdate: The provided field test@b.com does not exist as a property path on the node entity having ID 20965..\n\n#0 /var/www/html/modules/contrib/eca/src/Entity/Objects/EcaAction.php(99): Drupal\eca_content\Plugin\Action\GetFieldValue->access() #1 /var/www/html/modules/contrib/eca/src/Processor.php(210): Drupal\eca\Entity\Objects\EcaAction->execute() #2 /var/www/html/modules/contrib/eca/src/Processor.php(212): Drupal\eca\Processor->executeSuccessors() #3 /var/www/html/modules/contrib/eca/src/Processor.php(168): Drupal\eca\Processor->executeSuccessors() #4 /var/www/html/modules/contrib/eca/src/EventSubscriber/EcaBase.php(76): Drupal\eca\Processor->execute() #5 [internal function]: Drupal\eca\EventSubscriber\EcaBase->onEvent() #6 /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() #7 /var/www/html/modules/contrib/eca/src/Event/TriggerEvent.php(73): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #8 /var/www/html/modules/contrib/eca/modules/content/src/HookHandler.php(297): Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() #9 /var/www/html/modules/contrib/eca/modules/content/eca_content.module(97): Drupal\eca_content\HookHandler->update() #10 [internal function]: eca_content_entity_update() #11 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array() #12 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() #13 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith() #14 /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\Core\Extension\ModuleHandler->invokeAll() #15 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook() #16 /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(564): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() #17 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave() #18 /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(489): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave() #19 /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save() #20 /var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() #21 /var/www/html/modules/contrib/tca/src/TcaSettingsManager.php(56): Drupal\Core\Entity\EntityBase->save() #22 /var/www/html/modules/contrib/tca/src/FormManglerService.php(399): Drupal\tca\TcaSettingsManager->saveSettings() #23 /var/www/html/modules/contrib/tca/src/FormManglerService.php(342): Drupal\tca\FormManglerService->handleFormSubmit() #24 [internal function]: Drupal\tca\FormManglerService::staticHandleFormSubmit() #25 /var/www/html/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array() #26 /var/www/html/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() #27 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm() #28 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm() #29 /var/www/html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm() #30 /var/www/html/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult() #31 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult() #32 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array() #33 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #34 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext() #35 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() #36 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #37 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #38 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle() #39 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #40 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #41 /var/www/html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle() #42 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle() #43 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #44 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #45 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #46 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #47 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() #48 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #49 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle() #50 {main}
- 🇩🇪Germany jurgenhaas Gottmadingen
Problem 1: you should use
Entity: get field value
as suggested in my previous comment and notload entity by reference
. The former loads a list of entities for you to loop over, the latter only loads a single referenced entity.Problem 2: the error message tells that you're trying to read a field with the name
test@b.com
from a node with the ID 20965:Failed execution of Activity_1ubgy00 (Activity_1ubgy00) from ECA Send email to external/internal (process_f98b4rg) for event Drupal\eca_content\Event\ContentEntityUpdate: The provided field test@b.com does not exist as a property path on the node entity having ID 20965
That's clearly a misconfiguration of that action in the UI. You should review your settings and fix that.
I deleted the model, test node, and cleared my cache but that same error is coming up. ECA doesn't seem to be able to get the field contained inside a paragraph with
get field value
.I think I can only use
load entity by reference
, but I'm not able to get a list of the email fields. I want to be able to send the emails to each recipient individually.- 🇩🇪Germany jurgenhaas Gottmadingen
Get field value works with any type of content entities, also paragraphs. But I can't tell what's wrong, unless you wanted to share your setup.
Why do you think you can only use
load entity by reference
and notget field value
? Your reference field in your node that references the paragraph allows multiple paragraphs, right? I shared my model and I was able to add the paragraphs field. I was incorrectly adding the field inside the paragraph previously.
Now, I want to be able to collect the list of emails from
field_external_member_e_mail
, but it seems to be prepended by a number. I'm not sure how to proceed from here again.- 🇩🇪Germany jurgenhaas Gottmadingen
Please refer to my comment #2 where I explained that you need to loop over that list of paragraphs. That way you get access to the individual paragraphs one by one. I've linked a couple of samples in the ECA Guide that demonstrate how loops can be built.
Yes, I followed the loop example, but I seem to be just replicating the original list into a new token.
In
list:remove item
drop by specified value, I triedfield_external_member_e_mail
and[external2:field_external_member_e_mail]
. I seem to be creating a deadlock on the SQL.I also tried
drop first
and it is not giving me the results I need.Between the
list:remove item
andlist:add item
of my model, I triedget field value
for the email field but it is telling me the field does not exist when using tokensfield_external_member_e_mail
or[item:field_external_member_e_mail]
.- 🇩🇪Germany jurgenhaas Gottmadingen
I can't help, the model you uploaded doesn't contain that step.
Between the list:remove item and list:add item of my model, I tried get field value for the email field but it is telling me the field does not exist when using tokens field_external_member_e_mail or [item:field_external_member_e_mail].
Same pasted error from #3
- 🇩🇪Germany jurgenhaas Gottmadingen
There are 2 errors in the configuration of that
get field value
action:- In the field Field name you have to provide the field name. The description underneath clarifies: The machine name of the field, that holds the value. So the correct input would be
field_external_member_e_mail
- In the field Entity you have to provide the token name in which the entity is stored that has the field you refer to above. The correct input would be
item
because that's the token name that you decided to use in the remove list item action
- In the field Field name you have to provide the field name. The description underneath clarifies: The machine name of the field, that holds the value. So the correct input would be
Thanks, I thought entity was to create a new entity.
I removed adding emails to a list so that the email gets sent individually, but I am receiving duplicate emails (2 filled email addresses, but receiving the same email twice).
When I display the fetched emails to the user as an action instead of send email, it doesn't give me duplicate email addresses however.
Any thoughts?
I've followed exactly from #2 and your feature demo here: https://ecaguide.org/library/use%20case/eca_feature_demo and I still seem to be getting duplicate emails. I believe this is now a bug with ECA and paragraphs.
- 🇩🇪Germany jurgenhaas Gottmadingen
I can't reproduce the problem. I've used the latest model from #17 and added the email action. It sends to each email individually, no duplicates. The updated model is attached.
I looked at the model you uploaded and followed it exactly, but it still sends duplicates for me. Upon looking at the ECA logs, the model runs again after the loop is completed for some reason.
I don't have any other models that are modifying or saving the same content type either.
- 🇩🇪Germany jurgenhaas Gottmadingen
Upon looking at the ECA logs, the model runs again after the loop is completed for some reason.
If the same model runs twice, then something must be updating the entity again because that event is what actually gets the process started.
I disabled all models except for this one I'm having issues with but it is still sending duplicate emails. The Drupal logs shows ECA sends the email before and after the content is saved.
- 🇩🇪Germany jurgenhaas Gottmadingen
I can't think of any reason why this should go wrong in ECA. Again, if that model runs twice, that can only be because of the event to update that entity twice as well. You will have to debug your installation to find out, what's causing that. You can get started by setting a breakpoint in
\eca_content_entity_update
- Status changed to Postponed: needs info
4 months ago 6:57am 27 August 2024 - Status changed to Closed: outdated
11 days ago 11:05am 8 December 2024