Getting error when editing Advanced PDF/HTML Templates

I’m receiving the following error when previewing the NOAM – Charges Invoice PDF/HTML Template.

Failed to "?eval" string with this error:

---begin-message---
Syntax error in ?eval-ed string in line 1, column 8:
Encountered "ipsum", but was expecting one of these patterns:
"."
".."
<DOT_DOT_LESS>
"..*"
"?"
"??"
"!"
"["
"("
")"
<TERMINATING_EXCLAM>
---end-message---

The failing expression:
==> data?eval [in template "template" at line 290, column 110]

----
FTL stack trace ("~" means nesting-related):
- Failed at: #if (data?eval)?? [in template "template" at line 290, column 104]
----

 


                
Rookie Asked on June 2, 2023 in Other.
Add Comment
5 Answer(s)

Based on the reference to “ipsum” in line 6 of the error, I’d guess you’re getting that error when NetSuite attempts to validate the template and is throwing in some lorem ipsum text. Do you get that error if you save anyway and test with real data?

Rookie Answered on September 22, 2023.
Add Comment

Hi,

Could you please share that section from the actual template?

Thanks,

Chris

Advanced Answered on June 5, 2023.
Add Comment

<#if record.custbody_atlas_svcs_mm_json?has_content><#assign data = record.custbody_atlas_svcs_mm_json><#if (data?eval)??><#assign m = data?eval><#assign printEmployee = false><#assign printDescription = false><#list m["charges"] as itemList><#if (itemList.f?has_content)><#assign printDescription = true></#if><#if (itemList.g?has_content)><#assign printEmployee = true></#if></#list>

Rookie Answered on June 15, 2023.
Add Comment

What is (data?eval) ?

Rookie Answered on June 15, 2023.
Add Comment

It seems like you have JSON stored in a custom field that you want to parse and then use in the template.

Interestingly, Freemarker recommends against the use of eval, instead preferring eval_json.

https://freemarker.apache.org/docs/ref_builtins_expert.html#ref_builtin_eval

Does your field definitely contain properly formatted JSON?

Are you able to share that data too?

Advanced Answered on June 16, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor