Creating a New Line Program Token to Organize a History Field

Dan_Stevens_
Level 10 - Champion Alumni

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

Alex - we created a support ticket back on Aug. 1.  Marketo was able to reproduce this behavior (where it only rendered properly with trigger campaigns but not batch campaigns.  But since this is a P3 ticket, Support does not have the capacity to look further into this at this time.  Yes, frustrating.

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

Hi all,

this is probable a bit outdated, however, we run into the same problem and what did the trick for us was just removing the curly brackets from the script:

${display.br($lead.fieldName)} --> $display.br($lead.fieldName)

I am not a programmer, so I can't explain why it worked, but maybe it will help somebody.

SanfordWhiteman
Level 10 - Community Moderator

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

Mmm, neither of these can have any effect when line breaks do not exist at all in the source string.

They're also completely identical once parsed by the Velocity engine.

lillyfalcon
Level 3

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

hey @SanfordWhiteman @DanB did you manage to find a solution for the line break not displaying in email alerts? 

 

I inherited these scripts: 

${lead.legalvisionEmailClickHistory.replaceAll("%newline%","<br/>")}

${lead.legalvisionInterestingMomentsHistory.replaceAll("%newline%","<br/>")}

${lead.legalvisionWebPageHistory.replaceAll("%newline%","<br/>")}

 

but they were not working so I created {{my.line-break}} using method described in https://blog.teknkl.com/dark-mkto-alleys-line-break-token/# and replaced %newline% in flow step for {{my.line-break}}

 

however still no luck - this fixed the way the fields display in Marketo lead record

Screenshot 2023-08-21 at 3.35.45 pm.png

but not in email alerts 

Screenshot 2023-08-21 at 3.36.32 pm.png

 

I also tried changing the scripts to the ones you mentioned but no luck:

${display.br($lead.legalvisionWebPageHistory)}

${display.br($lead.legalvisionEmailClickHistory)}

${display.br($lead.legalvisionWebPageHistory)}

 

These are my flow steps:

if custom field is empty

{{system.dateTime}}: {{trigger.Trigger Name}} {{trigger.Name}} {{trigger.Web Page}}

else

{{system.dateTime}}: {{trigger.Trigger Name}} {{trigger.Name}} {{trigger.Web Page}} {{my.line-break}}{{lead.legalvisionWebPageHistory}}

 

I'm using an html email template coded for Marketo and referencing the token as follows 

 

Screenshot 2023-08-21 at 3.38.43 pm.png

I've tried contacting Marketo support but they said they cant help with velocity script syntax.

 

Any help would be much appreciated! 🙂 

Lilly Falcon
SanfordWhiteman
Level 10 - Community Moderator

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

This is a longstanding Marketo bug.

 

A Textarea field’s line breaks (that is, \n = standard U+000A) are simply stripped out before the field is output. This unfortunately includes when you try to manipulate the value in Velocity: the line breaks are gone before Velocity could even get a change to turn them into HTML breaks (<br>).

 

The workaround — and it’s quite cumbersome — is to add another type of break in addition to the \n.

 

I like to use U+001E before the U+000A.

 

So in the Line Break Token setup, instead of

%5Cn

do

%5Cu001E%5Cn

 

Then in VTL you can split on that:

${display.list($lead.field.split("\u001e"),"<br>")}

 

lillyfalcon
Level 3

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

Amazing! Thanks heaps @SanfordWhiteman 🙂 I'll give this solution a go 🤞

Lilly Falcon
Nate_Oosterhous
Level 7

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

Thanks Josh,

I will continue to research.  I haven't found anything yet that works.
Anonymous
Not applicable

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

I am having same challenge.

In the Marketo Flow Action logic the Attribute LOV only displays Lead attributes ( lead fields).

If you create a program token you will not find in the Lead attribute list.

Program Tokens are only available in Digital Assets  (EMail or LP) for now.