Just recently we noticed that an eval function gen...
# advancedpdf
b
Just recently we noticed that an eval function generates an error during validation. This must be something related to the new release. Before we could simply get the template validated without any errors. Now the following error will be thrown:
Copy code
--begin-message---
Syntax error in ?eval-ed string in line 1, column 8:
Encountered "ipsum", but was expecting one of:
".."
Why is NetSuite supplying the text “ipsum” at all during the template validation and more importantly how can I solve this issue? Part of the code where the validator seems to have a problem with all of a sudden can be seen below. FYI, the custbody would be filled with a JSON string.
Copy code
<#assign customrecord = record.custbody_rfi_tax_split_object?eval/>
d
NetSuite/Freemarker validates the template by populating variables/fields with Lorem Ipsum… 1, 2, 3… etc If NetSuite were using a version of Freemarker >= 2.3.31 (currently using 2.3.26) you could use the ?eval_json built-in If
record.custbody_rfi_tax_split_object
is guaranteed to be a stringified JSON, then you can use
?eval
and ignore the template error. HOWEVER, please read carefully the warning in the Freemarker docs for ?eval: if the JSON is coming from an untrusted/non-secure source, the
?eval
can be used as an attack vector
b
Thanks @David B