Hey, @JWright76, thanks for the fantastic question. I think you've gotten yourself pretty dang close here.
What about, instead of trying to assign the property directly, create it as a string first and then using the render filter to process it? This explicitly tells HubL to treat the contents of the string as HubL and to execute it.
{% set event_id_string_token = "{{ p145771107_hapily_registrant.event_id }}" %}
{% set rendered_event_id = event_id_string_token|render|trim %}
{% set event_id_int = rendered_event_id|int %}
If that fails, at least we'll have another clue to work with. Have fun testing! — Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Thanks for all responses on this. I actually got this working by simplly enabling programmable email for the module! It's a bit odd the way it failed without this enabled, a 'you're trying to using functions that require programmable email' message might be nice
Thanks, but it's giving me a cannot resolve property error in Design Manager.
I'm actually convinced that despite me using
{% set event_id = p145771107_hapily_registrant.event_id %}
It's still only setting event_id to be the literal value of: "{{p145771107_hapily_registrant.event_id}}"
as this is actually 41 chars long. I've tried using render filter also, but with no luck. So now I'm probably going to use a different approach now and just stamp the fields I need onto the event registration record, I'd prefer to be able to pull it straight from the event record, but think when you start having to do things like trim and regex replace the code becomes a bit prone to breaking. I will investigate further when have more time.
Hey, @JWright76, thanks for the fantastic question. I think you've gotten yourself pretty dang close here.
What about, instead of trying to assign the property directly, create it as a string first and then using the render filter to process it? This explicitly tells HubL to treat the contents of the string as HubL and to execute it.
{% set event_id_string_token = "{{ p145771107_hapily_registrant.event_id }}" %}
{% set rendered_event_id = event_id_string_token|render|trim %}
{% set event_id_int = rendered_event_id|int %}
If that fails, at least we'll have another clue to work with. Have fun testing! — Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
The issue you're facing with converting a string to an integer in HubL is a common one, especially when working with dynamic data like a custom object's event_id.
The main problem is the use of quotes and {{ }} inside your {% set %} statement. Those are only needed when you're outputting values, not when you're assigning them.
Instead of {% set event_id = '{{ p145771107_hapily_registrant.event_id |int }}' %}, use {% set event_id = p145771107_hapily_registrant.event_id |int %}
This will correctly apply the |int filter and store the result as an integer.
✅ If my reply answered your question, please mark it as a solution to make it easier for others to find.
Jun 16, 20257:28 AM - edited Jun 16, 20257:43 AM
Participant
HUBL: converting string to int
SOLVE
Thanks for getting back @ArisudanTiwari . I did actually try that but still no joy, although having output the length of the strings it seems there's something going on with the event_id field
{% set event_id = p145771107_hapily_registrant.event_id | string | trim %} {% set event_id_text = "167207073994" | string | trim %}
Thanks for all responses on this. I actually got this working by simplly enabling programmable email for the module! It's a bit odd the way it failed without this enabled, a 'you're trying to using functions that require programmable email' message might be nice