NElliott
03/21/2025, 8:59 AMCeligo AI
03/21/2025, 9:00 AMAI generated answer (using internal Slack threads):To reference a custom field containing JSON in an advanced PDF and make use of the key/value pairs, you would need to parse the JSON string into an object. This can be done using the
eval()
function in Freemarker, which is the language used in Advanced PDF templates in NetSuite.
Here is an example of how you can do this:
freemarker
<#assign myJson = record.custbody_my_json_field?eval>
${myJson.key1}
${myJson.key2}
In this example, custbody_my_json_field
is the script ID of your custom field, and key1
and key2
are keys in your JSON object.
Please note that the JSON stored in the custom field should be a valid JSON string. If it's not valid, the eval()
function will throw an error.
If your JSON is an array of objects, you can loop through the array using a <#list>
directive. Here is an example:
freemarker
<#assign myJsonArray = record.custbody_my_json_field?eval>
<#list myJsonArray as item>
${item.key1}
${item.key2}
</#list>
In this example, item
is each object in the array, and you can access its keys as shown.
Remember to replace custbody_my_json_field
, key1
, and key2
with your actual field and key names.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/21/2025, 9:00 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847172856
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84145689
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836835682
Celigo AI
03/21/2025, 9:00 AMCeligo AI
04/03/2025, 6:29 AM