Zoran R-DATAGRAM
04/25/2024, 12:31 PMcontext.response.writeFile(renderer.renderAsPdf(), true);
Now, they want to save PDF in NetSuite File Cabinet and have access without recreating every time when need the report.
My idea is to create a WorkFlow action for a custom record and first save PDF into File Cabinet, then store file id into field within custom record…
Question is >
How to invoke suitelet within workflow action script? Is it possible?
Now they invoke suitelet from the custom page and Submit button and client script
let suiteletUrl = url.resolveScript({
scriptId: "customscript_popdv_export_pdf_su",
deploymentId: "customdeploy_popdv_export_pdf_su",
params: {......
Zoran R-DATAGRAM
04/25/2024, 12:35 PMerictgrubaugh
04/25/2024, 2:04 PMZoran R-DATAGRAM
04/25/2024, 2:09 PMStefan Reeder
04/26/2024, 12:56 PM// rest of your script
var response = https.post({
url: suiteletURL,
body: parameters
});
var PDFfile = file.create({
name: "YourPDFfilename.pdf",
fileType: "PDF",
folder : 1234, // you must predetermine where to store it
encoding: file.Encoding.UTF_8,
contents : response.body
});
var PDFfileId = PDFfile.save();
// rest of your script
Stefan Reeder
04/26/2024, 1:01 PMlet pdfFileObject = renderer.renderAsPdf();
if (param.savefile === "T") {
pdfFileObject.name = "YourPDFfilename.pdf";
pdfFileObject.folder = 1234;
});
var PDFfileId = PDFfile.save();
context.response.write(PDFfileId);
}
else {
context.response.writeFile(pdfFileObject, true);
}
Stefan Reeder
04/26/2024, 1:07 PMZoran R-DATAGRAM
04/26/2024, 2:09 PM