To use NetSuite's custom print button with an HTML template, follow these steps:
Create an HTML template in NetSuite using the SuiteScript 2.0 HTML module or create an external HTML file and upload it to NetSuite's File Cabinet.
On the record you wish to print, create a custom button and set the following properties:
Replace XX and YY with the script ID and deployment ID of the Suitelet you will create in the next step.
function onRequest(context) { var recordId = context.request.parameters.id; var recordType = context.request.parameters.type; var printFlag = context.request.parameters.print;
if (printFlag == "T") { var renderer = nlapiCreateTemplateRenderer(); renderer.setTemplate('<nlobjtemplate templateid="123">'); renderer.addRecord(recordType, recordId); var result = renderer.renderToString();
context.response.writePage(result);
} else { // Return the Suitelet form here } }
Replace '123' with the ID of the HTML template you created in step 1.
Deploy the Suitelet and note the deployment ID.
Update the CustomPrintButton button's Function Definition with the correct script ID and deployment ID from step 4.
Save the custom button and test it by opening the record and clicking the Print button. It should open a new tab with the HTML template populated with the record data.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-05 14:36:43 +0000
Seen: 9 times
Last updated: Jul 05 '23
How to ensure a page break when creating Velocity HTML resumes?
What is the problem that arises when importing dynamic components in React with SSR?
What does an "Invalid Equation" error signify while creating HTML and MD reports using knitr?
In what way can I acquire the HTML source in C#?
Is it possible to have a HTML slider with two inputs?
How can HTML be integrated with Appjs React?
What is the reason behind getting the error message "File not found" in HTML?
What is the HTML tag for the title of the Divi Accordion module?
What is the process of incorporating "</>" into a HTML string?
What is the CSS that browsers use as default for HTML elements?