mautic / mautic

Mautic: Open Source Marketing Automation Software.
https://www.mautic.org
Other
6.84k stars 2.51k forks source link

Company Fields variables are not rendered when used in Dynamic Web Content #13084

Open oltmanns-leuchtfeuer opened 6 months ago

oltmanns-leuchtfeuer commented 6 months ago

Mautic Version

4.4.x series

PHP version

7.4

What browsers are you seeing the problem on?

Firefox, Chrome

What happened?

According to the documentation, Mautic should be able to render variables for company fields just as for lead fields: https://docs.mautic.org/en/setup/variables#company-contact-fields

However, when using variables for Company Fields in a Dynamic Web Content, the content is not rendered and thus not displayed. When using a contact-field instead it works as expected.

Also, there has been an unresolved entry in the forum for a similar issue: https://forum.mautic.org/t/company-token-custom-fields-not-displaying-in-dynamic-content-block/29237

How can we reproduce this issue?

Step 1: Create a Company and fill out fields like phone, website etc. Step 2: Create a contact and add the contact to the company Step 3: Create a non-campaign based DWC with a variable for a company field e.g. {contactfield=companyphone} in the content. Add a filter that is fulfilled by the contact from Step 2 eg. Email = not empty Step 4: Create a landingpage and add the DWC into the LP Step 5: Open Landingpage for the contact from Step 2 and see that no content is rendered.

Relevant log output

[2023-12-18 12:23:53] mautic.NOTICE: PHP Notice - Undefined index: log - in file /var/www/mautic/htdocs/app/bundles/DynamicContentBundle/Views/SubscribedEvents/Timeline/index.html.php - at line 11 {"mauticTemplateVars":{"app":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables: {})","event":{"event":"dynamic.content.sent","eventId":"dynamic.content.sent9","eventLabel":{"label":"DWC1","href":"/s/dwc/view/1"},"eventType":"Dynamic Content Sent","timestamp":"2023-12-18 12:23:27","extra":{"stat":{"dynamic_content_id":"1","id":"9","dateSent":"2023-12-18 12:23:27","name":"DWC1","sentDetails":[]},"type":"sent"},"contentTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","icon":"fa-envelope","contactId":"292"},"lead":"[object] (Mautic\\LeadBundle\\Entity\\Lead: Mautic\\LeadBundle\\Entity\\Lead with ID #292)","mauticContent":"lead","mauticTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","view":"[object] (Mautic\\CoreBundle\\Templating\\Engine\\PhpEngine: {})"},"app":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables: {})","event":{"event":"dynamic.content.sent","eventId":"dynamic.content.sent9","eventLabel":{"label":"DWC1","href":"/s/dwc/view/1"},"eventType":"Dynamic Content Sent","timestamp":"2023-12-18 12:23:27","extra":{"stat":{"dynamic_content_id":"1","id":"9","dateSent":"2023-12-18 12:23:27","name":"DWC1","sentDetails":[]},"type":"sent"},"contentTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","icon":"fa-envelope","contactId":"292"},"lead":"[object] (Mautic\\LeadBundle\\Entity\\Lead: Mautic\\LeadBundle\\Entity\\Lead with ID #292)","mauticContent":"lead","mauticTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","view":"[object] (Mautic\\CoreBundle\\Templating\\Engine\\PhpEngine: {})"} 

[2023-12-18 12:23:53] mautic.NOTICE: PHP Notice - Trying to access array offset on value of type null - in file /var/www/mautic/htdocs/app/bundles/DynamicContentBundle/Views/SubscribedEvents/Timeline/index.html.php - at line 11 {"mauticTemplateVars":{"app":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables: {})","event":{"event":"dynamic.content.sent","eventId":"dynamic.content.sent9","eventLabel":{"label":"DWC1","href":"/s/dwc/view/1"},"eventType":"Dynamic Content Sent","timestamp":"2023-12-18 12:23:27","extra":{"stat":{"dynamic_content_id":"1","id":"9","dateSent":"2023-12-18 12:23:27","name":"DWC1","sentDetails":[]},"type":"sent"},"contentTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","icon":"fa-envelope","contactId":"292"},"lead":"[object] (Mautic\\LeadBundle\\Entity\\Lead: Mautic\\LeadBundle\\Entity\\Lead with ID #292)","mauticContent":"lead","mauticTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","view":"[object] (Mautic\\CoreBundle\\Templating\\Engine\\PhpEngine: {})"},"app":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables: {})","event":{"event":"dynamic.content.sent","eventId":"dynamic.content.sent9","eventLabel":{"label":"DWC1","href":"/s/dwc/view/1"},"eventType":"Dynamic Content Sent","timestamp":"2023-12-18 12:23:27","extra":{"stat":{"dynamic_content_id":"1","id":"9","dateSent":"2023-12-18 12:23:27","name":"DWC1","sentDetails":[]},"type":"sent"},"contentTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","icon":"fa-envelope","contactId":"292"},"lead":"[object] (Mautic\\LeadBundle\\Entity\\Lead: Mautic\\LeadBundle\\Entity\\Lead with ID #292)","mauticContent":"lead","mauticTemplate":"MauticDynamicContentBundle:SubscribedEvents\\Timeline:index.html.php","view":"[object] (Mautic\\CoreBundle\\Templating\\Engine\\PhpEngine: {})"}

Code of Conduct

stale[bot] commented 2 months ago

This issue or PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like to keep it open please let us know by replying and confirming that this is still relevant to the latest version of Mautic and we will try to get to it as soon as we can. Thank you for your contributions.