I have an html module where im trying to display some of the contacts properties in an email template; the email is kicked off by a workflow.
When I preview the email, everyhing seems works fine, but when the workflow sends the emails the code doesnt work. I found that the issues seems to be that the value of the contact id is fetched as a string, not a integer; when i hardcode the id value using an integer it works.
Below is what i have tried so far -- using different combinations of it -- note that only the first line works:
{% set contact_id = 101 %} {# works both preview and email #}
{% set contact_id = request_contact.contact_vid %}
{% set contact_id = contact.hs_object_id %}
{% set contact_id = request_contact.contact_vid|int %}
{% set contact_id = contact.hs_object_id|int %}
{% set contact_id = request_contact.contact_vid|int + 0 %}
{% set contact_id = contact.hs_object_id|int + 0 %}
{% set contact_id = request_contact.contact_vid|int * 1 %}
{% set contact_id = contact.hs_object_id|int * 1 %}
{# get the contact #}
{% set crmContact = crm_object("contact", contact_id) %}
I was unable to pass the crm_object a variable containing a string. It seems only variables containing integers work. And without access to the contact id (I could be missing something) in the personalization dict this may not be possible.