pen one
05/31/2024, 8:19 PM{
"type": "error.SuiteScriptError",
"name": "USER_ERROR",
"message": "Error Parsing XML: The reference to entity \"c\" must end with the ';' delimiter.",
"id": "",
"stack": [
"createError(N/error)",
"onRequest(/SuiteScripts/sl_printAdvancedPdf.js:24)"
],
"cause": {
"type": "internal error",
"code": "USER_ERROR",
"details": "Error Parsing XML: The reference to entity \"c\" must end with the ';' delimiter.",
"userEvent": null,
"stackTrace": [
"createError(N/error)",
"onRequest(/SuiteScripts/sl_printAdvancedPdf.js:24)"
],
"notifyOff": false
},
"notifyOff": false,
"userFacing": false
}
If i instead make the advanced PDF the default template for the custom record (which I do not want to do) it works and the image is printed. If I have the image field blank the pdf prints via the userEvent created button.
Any ideas how to fix this? Below is my suitelet:
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define(['N/render', 'N/file', 'N/log', 'N/record'], function(render, file, log, record) {
function onRequest(context) {
var recId = context.request.parameters.recId;
if (recId) {
// Ensure recId is treated as a number
recId = parseInt(recId, 10);
// Load the record
var rec = record.load({
type: 'customrecord_show',
id: recId
});
// Create the renderer
var renderer = render.create();
renderer.setTemplateById(341);
renderer.addRecord('record', rec);
var pdfFile = renderer.renderAsPdf();
context.response.writeFile({
file: pdfFile,
isInline: true
});
} else {
context.response.write('Record ID not provided.');
}
}
return {
onRequest: onRequest
};
})
battk
05/31/2024, 8:32 PMbattk
05/31/2024, 8:34 PMbattk
05/31/2024, 8:35 PMbattk
05/31/2024, 8:35 PMpen one
06/03/2024, 2:20 PM