Re: Creating a New Line Program Token to Organize a History Field

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating a New Line Program Token to Organize a History Field

The field is checked off in the tree on the right-hand-side of Script Editor?

Dan_Stevens_
Level 10 - Champion Alumni

Re: Creating a New Line Program Token to Organize a History Field

It was when I initially created it (since I checked it; and dragged the field into onto the canvas) - but after checking now, it was not checked.  So repeated the process again (confirmed it's now checked, even after saving, closing and re-editing the script).  Here's the result:

pastedImage_0.png

Do you think I need to use two line-break tokens in the history field, instead of one?

Here's the value as it appears in the database:

pastedImage_0.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating a New Line Program Token to Organize a History Field

Nah, only need one. br() changes every single linebreak. What about if you manually hit enter in the field and add another line? That'll help us narrow down.

Dan_Stevens_
Level 10 - Champion Alumni

Re: Creating a New Line Program Token to Organize a History Field

Nope, same result as above.  Here's the new value in the DB:

2017-07-24 12:58:39: Promoted to MQL after attending an Avanade Event: 2017-06-14 NA USA EV-ML Retail Executive Summit-ERP TracyA

2017-07-24 12:48:44: Attended an Avanade Event: 2017-06-14 NA USA EV-ML Retail Executive Summit-ERP TracyA

2017-07-24 12:43:47: Registered for an Avanade Event: 2017-06-14 NA USA EV-ML Retail Executive Summit-ERP TracyA

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating a New Line Program Token to Organize a History Field

OK, now we know it isn't the line break token itself.

I'll check this again and get back.

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating a New Line Program Token to Organize a History Field

Dan, I can't repro this.

Here's text field with newlines:

pastedImage_0.png

The Velocity token to change the true newlines to <BR>s:

pastedImage_2.png

And the output:

pastedImage_1.png

Dan_Stevens_
Level 10 - Champion Alumni

Re: Creating a New Line Program Token to Organize a History Field

This is so odd - and such a simple test.  Not sure why you and I are experiencing this differently:

Added three lines to the Notes field (using regular line breaks (hitting "enter" after each) - not your technique.  Alternatively, I even tried using SHIFT-ENTER for a soft linebreak (and another time with two linebreaks):

pastedImage_0.png

The velocity token (Test-linebreak2):

pastedImage_1.png

The token placed in the email:

pastedImage_2.png

The output:

pastedImage_0.png

pastedImage_1.png

Dan_Stevens_
Level 10 - Champion Alumni

Re: Creating a New Line Program Token to Organize a History Field

I even tried another technique that you authored here: http://blog.teknkl.com/newlines-to-brs-in-velocity/

pastedImage_2.png

And still no luck.  I also tried using a bare-bones HTML email.  This is driving me crazy.

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating a New Line Program Token to Organize a History Field

So bizarre! What would Velocity be doing here if ​not ​altering the output... and not throwing an error?

It's as if your fields don't contain \n.

Can you try another replacement, as a sanity check?

${lead.Lead_Notes.replaceAll(".","<BR>")}

Dan_Stevens_
Level 10 - Champion Alumni

Re: Creating a New Line Program Token to Organize a History Field

Now we're getting somewhere.  Here's the email - where everything has been replaced with <BR> - the gray area is me highlighting them with my mouse:

pastedImage_0.png

And here's the code to prove it:

pastedImage_0.png

But I have no periods "." in that field.  What was replaced with all of those <br>'s?  Or did this replace every character (including the 2 line breaks) with a <br>?  There are are 17 characters (include the breaks), and 17 <br>s here.