How to modify xml before sending it to renderer

so I followed some guides on how to create a Suitelet that renders a record in an alternate Advanced PDF template. Everything as far as that goes is working fine.

I have a new challenge where I need to modify the data before it gets renderer by the template. (Specifically, the record only returns the units iid, so I need to separately look up the unit of measure text and insert it into the pdf).

The rendering uses the code below to render the PDF.  Does anyone have an example of how to get the record contents first, and modify the data before it gets passed into the rendering engine? (or a different way if I’m on the wrong track already)

// Create the Renderer Object
let renderer = Nrender.create();
renderer.addRecord({
    record: record,
    templateName: 'record',
});

// Add the chose template to the renderer
renderer.setTemplateById(templateIid);

// Generate an XML String from the renderer
let xmlString = renderer.renderasString();
Rookie Asked on May 3, 2021 in SuiteScript.
Add Comment
0 Answer(s)

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   Limebox   Become a Sponsor   Become a Sponsor