Kevin Baxter
06/01/2023, 2:50 PMCD
06/01/2023, 2:52 PMKevin Baxter
06/01/2023, 2:53 PMconst beforeLoad = (scriptContext) => {
try{
const recCurrent = scriptContext.newRecord;
const objForm = scriptContext.form;
const stStatus = recCurrent.getValue({
fieldId: 'status'
})
const stSuiteLinkParam = runtime.getCurrentScript().getParameter({
name: 'customscript_suiteletpdflink'
})
const suiteletURL = '\"' + stSuiteLinkParam + '\"';
if(stStatus === 'Pending Fulfillment'|| stStatus === 'Partially Fulfilled'){
objForm.addButton({
id: 'custpage_printbackorderitems',
label: 'Print BPI',
functionName: 'window.open(' + suiteletURL + ')'
})
}
}catch(error){
log.error({
title: 'Add Suitelet Button',
details: error.message
})
}
}
Kevin Baxter
06/01/2023, 2:54 PMKevin Baxter
06/01/2023, 2:54 PMconst onRequest = (scriptContext) => {
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n" +
"<pdf lang=\"ru-RU\" xml:lang=\"ru-RU\">\n" +
"<head>\n" +
"<link name=\"russianfont\" type=\"font\" subtype=\"opentype\" " +
"src=\"NetSuiteFonts/verdana.ttf\" " +
"src-bold=\"NetSuiteFonts/verdanab.ttf\" " +
"src-italic=\"NetSuiteFonts/verdanai.ttf\" " +
"src-bolditalic=\"NetSuiteFonts/verdanabi.ttf\" " +
"bytes=\"2\"/>\n" +
"</head>\n" +
"<body font-family=\"russianfont\" font-size=\"18\">\nРусский текст</body>\n" +
"</pdf>";
context.response.renderPdf(xml);
}
return {onRequest}
battk
06/01/2023, 3:16 PMstSuiteLinkParam
battk
06/01/2023, 3:16 PMreptar
06/01/2023, 9:05 PMurl.resolveScript
, not a parameter.reptar
06/01/2023, 9:08 PMform.addButton