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();
// Add the chose template to the renderer
// Generate an XML String from the renderer
let xmlString = renderer.renderasString();
I would generally advise storing the value you want to display on the record itself.
For example, before you render the PDF you can look up the value you would like to display and use Nrecord.submitFields to store the value on the record if the value isn’t populated already. Alternatively, if you are not concerned with historic data, you could have a User Event that populates the value on save of the afterSubmit of the record.
That way you can simply add the field reference to the template, rather than try to manipulate it before rendering.