Discussions
In 2.0 Redirect to Suitelet but in a new window
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,