parse string to int




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) %}




3 Replies 3
Recognized Expert | Partner

Hey @WRojas 

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.


@dennisedson might you have some light to shed?

Community Manager

Yeah, pretty sure @Kevin-C is correct here.  I can do some testing, but I won't be able to until next Monday.

@piersg , would be able to verify this?



We are excited to announce that the Community will be launching a weekly newsletter on November 2, 2020!
Sign up today!

@dennisedson @Kevin-C  thanks for the reply,


Do you have ideas as to how to go about this then? is there a way to passe the string into a integer and use that as the parameter?