Hello everyone, I'm having an issue with a block of hubl code, that unfortunately the support (through a ticket) couldn't help me with so I thought maybe someone has already delt with...
{% if !is_in_page_editor %}
{% if module.associated_event.id %}
{% set associated_events = crm_associations(speaker.hs_object_id, "USER_DEFINED", 44, "hs_object_id__eq="~module.associated_event.id, "hs_object_id", false) %}
{% if !associated_events.total %}
{{ set_response_code(404) }}
{% endif %}
{% endif %}
{% endif %}So the case is the following, i have two custom objects, "events" and "speakers", speakers are associated to events (one speaker one event, one event many speakers). Every event has it's own domain under which pages are created. One of the pages is a dynamic page that has the "speaker" as its data source. Because hubspot doesn't recognize associations on the frontend, it goes on to create a single speaker page for every speaker in the crm. The code above is a workaround to that issue, it checks if we are not in the page editor, then it takes the id of the event from a module field, next runs the association function to retrieve if the speaker is associated to the event, and finally if it is not, it throws a 404.
The hubspot support told me that the usage of 404 alongside the dynamic page creates the conflict and proposed some solutions that were not satisfactory to the usecase. They also told me that the team did not have an option to do the tests although I provided a test account with the issue reproduced.
Hope someone has some insight to this...Thank you in advance 😉