Issue with HubL int filter and custom values


I’m building a Transactional Email template, and trying to use the int filter to convert a custom value to an integer, but the filter always returns 0 (this has been asked before, but wasn’t answered).

If I have a template like the following:

<p>record_count raw: {{custom.record_count|pprint}}</p>
<p>record_count int: {{custom.record_count|int|pprint}}</p>
{% set x = custom.record_count %}
<p>x raw: {{x|pprint}}</p>
<p>x int: {{x|int|pprint}}</p>
<p>string int: {{"33"|int}}</p>

And send the following email via the Single Send API:

  "emailId" : 1234,
  "message" : {
    "to" : ""
  "customProperties" : [ {
    "name" : "record_count",
    "value" : 2

I get the following email:

record_count raw: (String: 2)

record_count int: (Integer: 0)

x raw: (String: 2)

x int: (Integer: 0)

string int: 33

Which means the int filter is working for a literal String, but not for a value that comes from a custom value (even when the pprint filter reports its type as String). Is this a bug in the HubL implementation?

- Toby

Issues with the types of custom properties in a Single Send email