SOLVED

Using lead tokens in javascript causing errors

Go to solution
Matt_Stone2
Level 9
I'm trying to set javascript variables using lead tokens, but it looks like the tokens spit out html entity versions (e.g. instead of "Matt" it spits out "Matt"), which cause all sorts of problems with the script.

Has anyone encountered this before?
Tags (1)
1 ACCEPTED SOLUTION
Matt_Stone2
Level 9
In case anyone finds this thread, I wanted to share the results of my discussion with support:

After being escalated to a higher-tier of support, I was informed that "...engineering was able to respond and let me know that this is unfortunately the intended behavior at this time. The value that is returned is due to us performing an HTML escape on tokens so those are the escape characters (ascii)."

Despite this, you can decode the characters to achieve the desired results with something like this:

var test = "{{lead.First Name}}";  
var decoded = $('<textarea/>').html(test).text();


And then you'll be left with the "decoded" variable that outputs properly.

View solution in original post

14 REPLIES 14