HubSpot Ideas

Neal

Apply line break formatting in to personalisation tokens in email

With personalisation tokens we can inset text into emails based on the relevant contact, company etc data.

However at the moment if you have a multi line text field with line breaks and paragraphs, this formatting will show correctly in HubSpot on the contact record, but in the resulting email there will be no line breaks and so the email content is a jumble into one paragraph.

Example:
"
ID: 1234
Name: John
Details: These are fake details
Number: 001122334455
"
gets formatted as:
"
ID: 1234 Name: John Details: These are fake details Number: 001122334455
"

29 Kommentare
jieyintan
HubSpot Employee

Hi Neal!

 

You could try adding line breaks in your property, and that should break the lines in the email as well when using multi-line text personalization tokens.

 

Add <br> in your propertyAdd <br> in your property

This is how the sent email with the token will look like.This is how the sent email with the token will look like.

Neal
HubSpot Employee

Thanks for pointing that out for anyone looking! 
For the HubSpot users I've seen needing this, having to add the HTML wouldn't really fit because it's usually something like a 'Ticket description' which is typed up organically by reps, but needs to be resent via automation. 

purrlo
Teilnehmer/-in

I've just realised that this thread is about something else (personalisation tokens in email),  but with the similar issue - but I can't delete my comment!

bscheerer
Mitglied

Would be very helpful for my business to be able to use multi-line text fields for lists that can be used in notes, tasks & emails through tokens. Having the formatting removed makes this not usable. 

Herschel
Stratege/Strategin

@Neal When I encountered this issue myself I was very frustrated, since you would think that multi-line text would display as multi-line text. When I saw the workaround @jieyintan offered I was happy that this was possible in some way, albiet a bit janky. It appears that recent changes Hubspot made have removed that workaround and I am now frustrated again and annoyed that Hubspot did not address this issue when they rolled out these changes.

We need the ability to display the information in a multi-line text personalization token property on multiple lines in our emails.

btws
Mitglied

A possible solution... I haven't tried this in email templates because I haven't started creating any yet, but I did do this in the beta for modifiable quote templates.

 

I wanted the product line item description to honour line breaks, obvoiusly. I noticed it worked on the prebuilt system quote templates so I inspected these and found hubspot use the "<pre>" html tag. As w3schools states, "The <pretag defines preformatted text". I added this to the quote template and it worked! 

Example:
<pre class="rich-text-body">{{ item.description }}</pre>

MelindaNelson
HubSpot Employee

Hi all, 

 

I was working on this issue with a customer and wanted to provide some details on how I was able to achieve this for internal email notifications.

 

  • Add <br> to the beginning of each property value

Screen Shot 2020-12-07 at 9.21.04 AM.png

  • Here's how these values were displayed in an internal email.

Screen Shot 2020-12-07 at 9.22.51 AM.png

Hope this helps! Let me know if you have any questions!

Herschel
Stratege/Strategin

@MelindaNelson just to clarify while this may work in internal emails, it no longer works in external marketing emails. Here is an excerpt from my discussion with Hubspot support about this issue:

HTML Code Does Not Render in Marketing Emails (2).JPG

MelindaNelson
HubSpot Employee

Thank you @Herschel! I've updated my post to clarify this is for internal email notifications.

ArnaudP
Teilnehmer/-in

So there's no solution currently to send emails with multiline properties?

 

Note that sending emails as text respect multiline properties though

MelindaNelson
HubSpot Employee

That is correct @ArnaudP. This isn't something that's available for marketing emails at the moment. It only works for internal notification emails. 

GEvgeneiadis
Mitglied

I would like to confirm that line breaks (and pre-formatted html) work only for internal emails.

Please fix this as it is prohibiting on sending emails with a proper look and feel.

This is crucial when you do not have the liberty to create multiple contact properties (using the API) or want to simply show a list(!!!)  and even more when combined with the inability to use Timeline Event tokens as personalization tokens in email templates (so we have to map them to contact properties etc.).

JBrake
Mitwirkender/Mitwirkende | Elite Partner

Text fields with line breaks which you want to appear on your page can be applied with the replace filter for example:

 

{{ item.description|replace("\n", "<br>")}}
 
 
Mike_Eastwood
Autorität | Gold Partner

@JBrake genius! Thank you.

brianzimorowicz
Mitglied

@JBrake  @Mike_Eastwood   Please read the original question before posting. OP is asking for Marketing Emails, not pages or templates.

"Please note that using filters on any personalization variables (such as but not limited to contacts, company, and deal variables) is not currently supported for email in HubSpot due to how emails are rendered. Filters can be applied to these properties on HubSpot CMS page and blog templates." Source 

APathak
Mitglied

<br> can be implemented within hubsport to implement line breaks and paragraph but what if the values are coming salesforce?

MM2
Mitglied

We need this as well! It is quite annoying to having to work around line breaks.

bradgerlach
Mitwirkender/Mitwirkende | Platinum Partner

I can confirm that <pre class="rich-text-body"></pre> works in emails as @btws suggested. 

purrlo
Teilnehmer/-in

@bradgerlach thanks for mentioning this, it solved my issue as well!

brianzimorowicz
Mitglied

@btws  @bradgerlach  Its odd that this did not work for me in May, but it does indeed work for me now in marketing emails, 3 months later. Thank you both.

 

Example:
<pre class="rich-text-body">{{ item.description }}</pre>