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

Nate_Oosterhous
Level 7

Creating a New Line Program Token to Organize a History Field

Hello Everyone!

I really need your help on this one.  

Question: Does anyone know how to create a program token that would create a new line if added to inbetween tokens.  

I am looking to format a history field like the example below:

Filled out Form on: 2015-03-10 13:00:00  Form Comments: This is the comments from the 3rd form fill out.

Filled out Form on: 2015-02-10 12:00:00  Form Comments: This is the comments from the 2nd form fill out.

Filled out Form on: 2015-01-10 11:00:00  Form Comments: This is the comments from the 1st form fill out.

Right now it looks all mashed together like this:

Filled out Form on: 2015-03-10 13:00:00  Form Comments: This is the comments from the 3rd form fill out.
Filled out Form on: 2015-02-10 12:00:00  Form Comments: This is the comments from the 2nd form fill out.Filled out Form on: 2015-01-10 11:00:00  Form Comments: This is the comments from the 1st form fill out.

Below is my Flow Action: 


0EM50000000SyWM.jpg

I am looking to figure out some way to use a program token in the default choice of this Change Data Value Flow.  Right now I have a program token in the place where I want it but I can't figure out how to get that to represent two new lines.

 
Tags (1)
47 REPLIES 47
Josh_Hill13
Level 10 - Champion Alumni

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

oh so you want a new line in a field.
 

Do a quick search. there are some threads on this. It is not easy.

Anonymous
Not applicable

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

I've been searching and reading for months for a solution to this. If you have any links to info, please share.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

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

I've got a method that works.  It's delicate and it's probably best if I walk you through it remotely.  DM me if you want.

Example audit trail field:

pastedImage_0.png

SanfordWhiteman
Level 10 - Community Moderator

Re: 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

Sanford Whiteman, your solution works great when the values need to be stored like this in a history field.  The issue arises when we use that history field as a token in an email.  For example, here's the value in the lead record:

2017-07-24 13:48:10: Visited 5 or more web pages in 1 day

2017-07-24 12:14:09: Filled Out Contact Us Form as Potential Customer (Overseas Adventure Travel): Contact Us 2.0 (USA) on www.avanade.com/en-us/contact

But when we use {{lead.Interesting Moment History}} in an email alert, it appears as follows (with no line breaks):

pastedImage_1.png

Any ideas on how to have this render properly in an email?

SanfordWhiteman
Level 10 - Community Moderator

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

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

in a Velocity token.

Different output contexts, different line break sequences....

Dan_Stevens_
Level 10 - Champion Alumni

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

That doesn't seem to work.  Here's the exact velocity token - called {{my.IM History}} that I'm using:

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

For your reference, the history field is built as follows:

{{lead.Last Interesting Moment Date}}: {{lead.Last Interesting Moment Desc}}{{my.line-break}}{{lead.Avanade Interesting Moment History}}

where "my.line-break" is using the approach you describe in this post.

SanfordWhiteman
Level 10 - Community Moderator

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

What kind of "doesn't work" -- what's the output HTML?

$display.br() is a built-in method to replace true newlines with HTML <br />, so it's perfect for this. (We could write the replacement in VTL but shouldn't need to.)

Dan_Stevens_
Level 10 - Champion Alumni

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

Here's the token:

pastedImage_1.png

Here's how the token is used in the email alert:

pastedImage_4.png

And here's how it renders in an email (instead of pulling the history value from the lead record, it's including the actual script):

pastedImage_3.png