In Advanced PDF templates, how do I reference the ...
# ask-stanley-ai
a
In Advanced PDF templates, how do I reference the internal ID of the transaction record to be rendered?
c
AI generated answer (using internal Slack threads):
In Advanced PDF templates, you can reference the internal ID of the transaction record using the
${record.id}
syntax. This is part of the Freemarker templating language that NetSuite uses for Advanced PDFs. Here is an example of how you can use it in a SuiteScript:
Copy code
javascript
var renderer = render.create();
renderer.addRecord({
    templateName: 'record',
    record: record.load({
        type: 'invoice',
        id: results[i].id,
    })
});
renderer.templateContent = 'INV: ${record.tranid} ${record.id}<p style="page-break-after: always;"></p>';
var xmlStr = renderer.renderAsString();
In this example,
${record.id}
is used to reference the internal ID of the record being loaded. The
record.load
function is used to load the record, and the internal ID is passed as an argument. The
renderer.templateContent
line is where the internal ID is referenced in the template. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836050272
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834054828
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83089596
Please provide your feedback on this answer.