/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
* @NModuleScope Public
*
*/
define([
'N/record',
'N/search',
'N/ui/serverWidget'
]
, (
record,
search,
serverWidget
) => {
beforeLoad = (context) => {
if (context.type == context.UserEventType.PRINT) {
const newRecord = context.newRecord;
// Create the custom field to save data
let dataForPDF = context.form.addField({
id: 'custpage_data_for_pdf',
type: serverWidget.FieldType.LONGTEXT,
label: 'data for pdf'
});
dataForPDF.updateDisplayType({ displayType: serverWidget.FieldDisplayType.HIDDEN });
// Call Search function(s) to get all the data you need. This should return an object
let dataObject = getData();
dataForPDF.defaultValue = JSON.stringify(dataObject);
}
}
getData = () => {
// get all the data using searches or SuiteQL
return dataObject;
}
return {
beforeLoad: beforeLoad
};
});
<#assign data = record.custpage_data_for_pdf?eval> <p> ${data.field}</p>
Jaime Requena is a seasoned NetSuite Consultant and Solutions Architect, known for delivering WHITE GLOVE service to businesses. With 15+ years of experience and 3x certifications in ERP, Developer, and Admin, Jaime specializes in highly customized NetSuite accounts, transforming operations for 200+ satisfied customers all across the globe.
We aim to bring unmatched expertise and professionalism to your NetSuite initiatives. Let’s talk about how our NetSuite consultancy can make a difference!
It’s Been 4+ Years Now And We Have Worked With Hundreds Of Clients, Building Our Way To The Top, One Happy Client After Another! Their Voices Of Satisfaction Serve As A Testament To Our Success –