Re: Return Character in Change Data Value

Anonymous
Not applicable

We are using change data value to append a field to a field history. Ideally, we would like to enter a line break between each entry to make it easier to read. Currently I have:

{{system.dateTime}} - {{lead.Comments (form)}}  {{lead.Comments(History)}}

But I would like it to be formatted as

{{system.dateTime}} - {{lead.Comments (form)}} 

{{lead.Comments(History)}}

both fields are text areas and can handle a line break, but I cant figure out how to add one using a flow action.

I have tried adding /n, /r... but it just adds the characters. Is there a wrapper I need to use to have it change the value correctly.

20 REPLIES 20
Grégoire_Miche2
Level 10

Has anyone entered and idea about this ?

I'll vote.

-Greg

Robb_Barrett
Level 10

I just upvoted. Our sales folks are complaining about sending over unformatted notes.  A step further would be to make the CDV a Rich Text Editor with bullets, bolds, etc but I'm sure that'd be tricky depending on the CRM it's sending to.

Robb Barrett
Anonymous
Not applicable

Agreed, this would make this much easier    

SanfordWhiteman
Level 10 - Community Moderator

Justin, I don't think I ever heard from you about this.  You can create a {{my.linebreak}} token using my method that'll work fine.

Anonymous
Not applicable

Hi Sanford,

Thanks! Im assuming that my.linebreak is a richtext token with a linebreak in it?

SanfordWhiteman
Level 10 - Community Moderator

Yep.

Anonymous
Not applicable

Hi Justin,

I'm pretty sure everything when viewing a lead record is set to not interpret encoding like that, to avoid the security risk of code injection through a form or if an API were to be compromised. I think if the field is synced to a rich text field in SFDC you might be able to use HTML characters like <br> though.

SanfordWhiteman
Level 10 - Community Moderator

I'm pretty sure everything when viewing a lead record is set to not interpret encoding like that

Nah, textarea/longtext must support \n.

Anonymous
Not applicable

I'm a little confused about what you mean by "must" support. If you do a change data value that uses "\n", it will not show a line break when you view the lead record. In general, I'd advise against adopting flows that require such "hacks", as they tend to rely on aspects of Marketo that may be fixed down the road (thus causing them to "break"), and will at the very least cause confusion to future admin users in your instance.
@justin - where are you trying to see line breaks? Is this for yourself when viewing lead records in Marketo? Or is it for your sales team?

Grant

SanfordWhiteman
Level 10 - Community Moderator

I'm a little confused about what you mean by "must" support.

I mean that the Marketo textarea/SFDC longtext must support embedded line breaks.  Otherwise, it could not hold data that contains line breaks, which it does (you can post such data directly from a form textarea, for example).

A second question is whether flow rules as saved in your Marketo instance can have line breaks.  This, too, is supported.

The part that's broken is that the widget in the Marketo UI that is used to manage flow rules is a one-line textbox that does not support embedded line breaks.  They are removed even before the data is sent to your instance.

That's why the hack has to skip the rules applied by the textbox display widget, since those are stricter than the rules of the underlying database(s) -- a pattern found somewhere in almost every web app.  (If and when flows can be updated via API there would be no reason to reproduce this display rule.)

If you do a change data value that uses "\n", it will not show a line break when you view the lead record.

That's because the escaped character "\n" never gets unescaped.  It's a literal "slash-followed-by-lowercase-n" in that context.  demo

So by adding a literal "slash-n" you aren't even trying to add a line break.  

The fact remains, though, that even if you do put (programmatically) a true line break the textbox, it will also get stripped by default.  So you need to go a level deeper.

In general, I'd advise against adopting flows that require such "hacks"

Sure, but if you want it now, you have to use a hack.

Aslihan_Ayan_Ha
Level 7

Thanks for your help.

Anonymous
Not applicable

I would like to be able to see it in Marketo on the Lead record itself. I currently have all the data there, it is just a bit difficult to read... The sales team usually doesn't pay much attention unless I were to notify them directly via email.

-Justin

John_Clark1
Level 10

Hi Justin,

This isn't currently possible, as the flow step doesn't interpret special characters.   I've been trying to work out some other way to do it, but I'm coming up blank.  I would encourage you to submit an idea on it.  I'd vote for it!

John

SanfordWhiteman
Level 10 - Community Moderator

I've done it.  It's a delicate hack.  Showed a demo the other day of the results but no one seemed interested!

The major problem with is it isn't a one-time setup: anytime you make a change to the Smart Campaign you have to remember to redo it.  It amounts to subverting the UI validation so it always has to be the "last touch" of the SC.

Anonymous
Not applicable

Can you provide some additional detail on what was done in the 'hack'?

SanfordWhiteman
Level 10 - Community Moderator

Contact me privately and I'll show you how it's done.

Anonymous
Not applicable

Sanford Whiteman can we get you to show the goodies? Haven't been able to get this to work with rich text tokens.

SanfordWhiteman
Level 10 - Community Moderator
Anonymous
Not applicable

Not sure I follow - were you able to use /n?

SanfordWhiteman
Level 10 - Community Moderator

Not sure I follow - were you able to use /n?

Of course.  I wouldn't say I had a method otherwise!