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?

Rookie Asked on September 26, 2024 in SuiteScript.
Add Comment
2 Answer(s)

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

Advanced Answered on October 2, 2024.
Add Comment

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!

 

Rookie Answered on October 15, 2024.
Add Comment

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