CMS Development

hilton22
Contributor | Diamond Partner
Contributor | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hello everyone,

 

I'm trying to build an email template with a CTA for an external link. This URL has some parameters with Hubspot tokens:
'https://www.example.com?email={{contact.email}}&my_property={{contact.my_property}}'


The 'my_property' field is a dropdown menu. In this case, Hubspot places the option's label by default as a value, but I need to place the internal value of this option and not the label.

 

Is there any way to do this? If so, what would be the correct syntax?

 

I'm looking for a solution in the HubL documentation, but I haven't had success yet.

 

can anybody help me?

 

Thanks,

0 Upvotes
8 Replies 8
TGreenlaw
Member

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

If you use contact.my_property.value, it will return the internal value instead of the label.

It's completely nuts that Hubspot defaults to returning the label instead of the value for dropdowns.

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hi @hilton22 ,


I checked a few other posts, and sadly it seems as if you can not retrieve the internal value through a contact token. It will always return the label. What you could do, is create a custom module where you set the correct internal value based on the label. Something like this:

{% if contact.my_property == 'The Bromfield School' %}
 {% set my_property_value = 8762342352 %}
{% elif contact.my_property == 'Something else' %}
 {% set my_property_value = 8762342352 %}
{% endif %}

 

If you have a lot of options in your property, you could turn to HubDB and store them there as well, as you can retrieve HubDB data in email with the programmable email beta.

I know this is quite a lot of work to achieve something that simple, but this should help you out.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
hilton22
Contributor | Diamond Partner
Contributor | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hello @Teun,

 

In fatct, I'm already using de HubDB for this project. I'm gonna dig into this programmable email doc, seems very promissing for what I'm trying to do.

 

Anyway man, thanks very much for your help... again!

 

Cheers,

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hi @hilton22 ,

 

Awesome, that should make it a lot easier. Let me know if you need any help.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hi @hilton22 Yes it is haha!

 

Is the value very different from the label? Could you send some examples?

Do you use this in a custom module or directly in the email template?



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
hilton22
Contributor | Diamond Partner
Contributor | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hello @Teun,

 

Yes, the label is very different from the internal value, exemple:

Label: 'The Bromfield School - Massachusetts'

Value: 87623452352

 

This value is a ID from another application that needs of those ID's to proceed with process.

And yes, I'm using directly in the e-mail template. But of course, if you have any other sugestion, I can chage the approach.

 

Thanks again mate!

 

Cheers,

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hi @hilton22 ,

 

What do you get if use the |pprint filter?

So:

{{contact.my_property|pprint}}

Should show you all contents of the property and how you can access any other values available. 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
hilton22
Contributor | Diamond Partner
Contributor | Diamond Partner

E-mail template Hubspot Tokens - Get internal value from contact dropdown property

Hi @Teun, it's you again... hahaha!

 

Thanks again for the help, mate!!!

 

The result in the CTA URL was: 'https://example.com?my_property=(String `the_option_label`)&...'

It's still prints the label for the option and not the internal value.

 

Cheers,

 

0 Upvotes