I am trying to render a saved search result to an exiting advanced pdf template.
The code below renders a blank browser page . The execution log returns “Missing parameters required to generate PDF.
renderer = render.create();
renderer.setTemplateByScriptId({
scriptId: “custtmpl _stcbookingcertificate”
});
renderer.addSearchResults({
templateName: templateName,
searchResult: searchResult
});
var newfile = renderer.renderAsPdf();
newfile.name = ‘Weight Certificate.pdf’;
newfile.folder = 491634;
// Save the file
newfile.save();
Does anyone have any ideas?
Hi,
templateName: templateName
templateName on the right is a variable that isn’t defined. Typically this would be. string that you would then use in the template.
e.g.
templateName: ‘result’
${result.<column_name>}
Let me know if you need any further help.
Thanks,
Chris
The issue seems to stem from missing parameters when rendering the PDF, as suggested by the error message. One potential problem could be with how you’re passing the search results or template name. Ensure that the templateName and searchResult are properly defined and populated. Also, confirm that the search result is correctly formatted and has data.
Try checking if the search result is returning data by logging it before passing it to the renderer:
log.debug(“Search Results”, searchResult);
This will help you verify if the search result is correctly fetched. Additionally, ensure that all required parameters for the template are set correctly.
If the issue persists and you need expert assistance, you can reach out to Codinix Technologies for professional support and consulting. They specialize in SuiteScript development and can provide tailored solutions. Contact them for more information!



