So I went ahead and created a test trigger campaign and all tests rendered successful. So I've confirmed (unless proven otherwise) that when velocity scripts - or maybe just some - are used within alert emails that are part of a batch campaign, only the token itself will render, and not transformations on that token. For example, this:
will not insert <br> for all line-breaks, but it will display the unaltered value contained in the lead field (in this case "Avanade Interesting Moment History")
I don't think that's it: I think it's that the linebreaks are changed to spaces, so .br() runs but has nothing to do.
Is there another type of "search/replace" script that can be used on normal text strings? I can then run it on something we can see; and something that's present in both batch and trigger campaigns.
Sure, that code above with replaceAll() changing every char (".") to "<br>".
Mine's ok now as well. Not sure what that was all about. Anyway, I just ran that script using a batch and trigger campaign - and it rendered fine both times:
"test1 test2 test3" transformed to "DAN1 DAN2 DAN3"
So your theory is back on the table.
So I think the way to address it is Why is Marketo changing linebreaks to spaces only for batches? I wonder if anyone else is lurking on this thread and can share their findings.
I have the same problem with removed line breaks. Did you try to contact Marketo support to resolve the issue?
How are you inserting the line breaks originally? To make sure this is the same case.