Hi all,
I have added a Print Label button in my 2.0 userevent beforeLoad and attached a Suitelet to it.
var printLabelSU = url.resolveScript({
scriptId :'customscript_xxx_su',
deploymentId :'customdeploy_xxx_su',
returnExternalUrl : false
}) + '&recId=' + scriptContext.newRecord.id;
var printLabel = "window.open('"+printLabelSU+"','_blank');";
scriptContext.form.addButton({
id : 'custpage_print_label',
label : 'Print Label',
functionName : printLabel
});
On the click of this button, the Suitelet renders a pdf and opens it in new window.
I need to achieve similar task on Save of the record.
So in userevent afterSubmit I am calling
redirect.toSuitelet({
scriptId: xxx,
deploymentId: x,
parameters: {'recId': scriptContext.newRecord.id}
});
The Suitelet does its job and generates the pdf.
But I need the pdf to be opened in a new window.
Note that js window.open(url, '_blank') is a client side function, so cannot use it here.
Can someone please help.
Thanks,
Raj