Looking to see if anyone has come up with a workaround for this. I’ve got a custom module for an email that generates a QR code; the qr contains a URL that pre-fills a HubSpot form.
I’m trying to pass a Mutiple Checkbox property (contact.event_attended) into the URL. I’ve found that to work it requires “Value A;Value B” to populate.
No matter what HubL filters I’ve applied, it displays as a comma separated “Value A, Value B”.
Based on debugging, the property is not behaving like a string or list as expected. Things I’ve found:
{{contact.event_attended|pprint}} --> (VarPassThroughReplacer: {})
and the raw output is |Value A, Value B| but for whatever reason replace fails to find this comma.
I’ve already tried replace, join, and a coercion using {{ (“” ~ contact.event_attended)|replace(', ', ‘;’) }} but everything has been ignored or returned the comma separated output.
Has anyone been able to manipulate the delimiter within this context? I’ve hit a deadend with the VarPassThroughReplacer so is there a trick to access the property value for a Custom Module?
Hey @PHA_iPadag - thanks for posting in the Community!
While I’m not personally familiar enough with the content of this use case to provide a solution, I’d like to tag in some Community experts who may be. @Phil_Vallender, @Anton, and @SteveHTM - any insight on on this inquiry?
Shane, Senior Community Moderator
@PHA_iPadag - I feel here that I’m missing something about the core problem. Can you give an example of the way that the URL you are trying to create should be formatted vs what you have been able to resolve using HubL functionality?
I’ve spent a lot of time manipulating multi-checkbox values in different contexts using API calls and other mechanisms. While HubSpot did not do the developer community any favors when it reversed logic about returning external/label values vs internal “as it is stored” values in API calls, the underlying mechanisms seem to have some continuity and should be applicable in this case.
Steve
Hi Steve!
Thanks for responding. I’m fairly new to HubSpot and custom modules so still learning as I go. I need the URL to be formatted with semicolons so the Form pre-fills correctly: “…event_attended=Value A; Value B”
Currently the URL will output either "event_attended= " or “event_attended= Value A, Value B” depending on how I try to manipulate the input.
My current iteration, which resolves to comma separated values, looks like this:
{% set captured_output %}
{{ contact.event_attended }}
{% endset %}
{% set raw_events = captured_output|trim|replace(', ', ';') %}
<img src="https://api.qrserver.com/v1/create-qr-code/?data=...&event_attended={{ raw_events|urlencode }}">
If you have defined event attended as a multi-checkbox property, then Ii don’t belive you should treat it as a string in your HubL manipulation.
I haven’t worked example code up in my own instances, so I don’t have examples to share, but I’d be trying to form the URL query string through an iteration over the values of the property seen as a list. The iteration can use the right encoded URL values as you format the required string value.
If you feel that you have to create a list in your ‘set’ operation as you illustrated above, then you could use the ‘split’ HubL filter on the contact property and use the iteration on the HubL variable.
Hope this is helpful.
Steve
Thanks for the suggestion. I really wanted to accomplish this inside of the costume module so I ran a test to try and loop through the values. E.G.
{% set built_list = [] %}
{% for item in contact.event_attended %}
{% do built_list.append(item) %}
{% endfor %}
{{ built_list|length }} items found.
However, the result was “0 items found”. It seems that whatever the VarPassThroughReplacer inside the email editor is not iterable despite displaying as such. I wasn’t able to find anything in the developer KB about the object.
For anyone reading this, since I wasn’t able to accomplish it natively. I’ve opted for a workflow workaround until I can figure this out at a later point. We have Data Hub but essentially here’s the steps:
- Helper Property: contact.event_attended_formatted
- Workflow: Trigger - event_attended changes and new value is known
- Action 1: Format Data - Replacing ", " with “;” then saving result to event_attended_formatted.
Then using the event_attended_formatted in the URL string. Thanks again to Steve for helping troubleshoot and hope this is helpful for someone!
I can’t see a reason why this could not be done inside a custom module; Let me riff as follows.
{% set event_list = contact.event_attended | split(";") %}
{% for event in event_list %}
...code to construct URL string
{% endfor %}
Steve
@PHA_iPadag Email is very limited in what it can do with CRM data unless you have access to programmable email modules (which is limited to Professional and Enterprise accounts). Without you cannot use filters on CRM data variables.
A workaround would be that you could create a new single line text property event_attended_url and use a workflow to to generate the intended string into it and use that variable in the email.