Hi all! I'm trying to use ?eval to use the JSON in...
# advancedpdf
d
Hi all! I'm trying to use ?eval to use the JSON in a long text field but its causing errors. As an example, my field has: `{ "item": "444124", "amount": "4177.516", "quantity": "1"}`but when I try to evaluate or get just the item from ${field.item}, it fails. Am I missing something or doing something wrong?
r
maybe you are looking for ?eval_json
d
@redfishdev tried that too and got the same/similar error
wondering if I need any additional characters in the string?
r
did you eval like it says like
Copy code
<#assign data = dataJson?eval_json>
<p>Name: ${data.name}
assigning to a variable first
d
yep, exactly that like some other examples and still got the error
r
is this in script ?
or from a field value
could be going through escape if in field value
d
no, this is in the advanced pdf. The script sets the json string in a custom field
r
there is a script that sets a fields value and sends to advanced pdf?
d
just the standard advanced pdf print on an invoice but issues with trying to manipulate my custom field data into a json to set in a table in the pdf
r
so you set the field value in UI and then call standard PDF via netsuite UI and not via script?
d
yes
r
well likely the Netsuite DataStore is going to escape the JSON " characters... but if you write out without ?eval what do you get? The escaped original?
d
yes, just the string. and when I try to add ?eval it fails to create the PDF; from the print option it just says unknown error but when saving the PDF it says it doesn't recognize this built in function or was expecting a different character
message has been deleted
r
why does it say "eval-ed" what is the source line?
sometime I get errors from Netsuite but valid freemarker and save anyways. 70% of the time it is netsuie parsing but works
so I try it anyways
d
not sure why but it's just the custom field assigned as a variable
but when you do save anyways it won't print; gets that unexpected error contact netsuite
r
can you share the actual source for the line cuasing error?
looks like alot of freemarker functions are not avail in NS
maybe you can have hidden fields in NS that have the underlying data . They can be updated when ou update the JSON in main field
then they would easily be available
I assume some integration is adding the JSON to the field otherwise why have mulitple fields in one field in essense
but maybe someone knows more