Hi there,
I tried to implement a simple velocity script to parse out a JSON object and it is giving me this error:
Cannot get email content- <div>An error occurred when procesing the email Body! </div> <p>Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 2, column 1. Encountered: "\uff8a" (65418), after : "" near</p> <div><pre >#end</pre><pre >#set($parsedJson = '#set($parsedJson='+ $data+')')</pre><pre class="x-form-item-label">#evaluate($parsedJson)</pre><pre >$parsedJson['proofpoint']</pre><pre ></pre></div>
The JSON object I imported was:
{"proofpoint":"This is a test proof point","subject line":"test subject line","EID":"1234"}
and the velocity script (for online the proof point token) was:
#set($data = ${scoutContentEngine_cList.get(0).xLROppy})
#if($data.isEmpty())
#set($data='{}')
#end
#set($parsedJson = '#set($parsedJson='+ $data+')')
#evaluate($parsedJson)
$parsedJson['proofpoint']
Any ideas as to why this is happening?
Solved! Go to Solution.
Hi @Kainelson -
I faced similar issue in the past. This is due to format of the imported file. You must have imported the data using UI and file must have contained some spaces or may not be in utf-8 encoding. Just try to have proper csv with utf-8. This should work. Velocity code you posted seems perfectly fine.
please let us know in case you still face any issue.
Remember to use the Syntax Highlighter (“Insert/Edit code sample”) so your code is readable.
I edited your post this time.
Assuming
$scoutContentEngine_cList
xLROppy
Then there’s nothing wrong with your code itself.
(N.B. it’s better to not have to make these assumptions from your code and to have them all laid out in your question.)
Questions:
Assumptions:
Questions
2. No Japanese in the email
3. I previewed by person. I looked at my record that I uploaded data on in the database.
4. I looked at the field in the custom object on my record.
Please create a brand new mail based on the Personal Note template (i.e. to avoid confusion with any custom modules) and test with that.
Also include the output of a {{my.token}} with only this line in it (of course also checking off the fields in the tree on the right hand side):
${scoutContentEngine_cList}
Hi @Kainelson -
I faced similar issue in the past. This is due to format of the imported file. You must have imported the data using UI and file must have contained some spaces or may not be in utf-8 encoding. Just try to have proper csv with utf-8. This should work. Velocity code you posted seems perfectly fine.
please let us know in case you still face any issue.
Thank you!
You do not need to use UTF-8. A UTF-16LE CSV works perfectly fine (that’s Microsoft Excel’s “Unicode” format.)
If there are extra characters, they’re not in the text provided here by @Kainelson. So either the text in this thread is not actually what’s stored in the CO (which is why I asked specifically for the raw output of the CO list in an email) or something else is happening.