Saurabh More
Saurabh More

Reputation: 413

Open URL in new window netsuite suitescript 2..0

I have created a suitelet script. I want to run it in new window. For that i have created a custom button on sales order and passed a 2.0 client script function on button(to redirect to the suitelet). Currently the suitelet gets opened in same window on click of button.

The Client Script : 
/***@NApiVersion 2.0*@NScriptType ClientScript*/
define(['N/url'], function(url){
var pageInit = function(context) { }
var closebutton = function(context) {
try
    {
window.location= url.resolveScript({
        scriptId: 'customscript337',
        deploymentId: 'customdeploy_sdm',
        returnExternalUrl: false
   });
        return false;
    }
catch(err) {
        log.debug({ title: 'ERROR', details: err });
    }
}
return {
pageInit : pageInit,
        closebutton : closebutton
}`pageInit : pageInit,
        closebutton : closebutton
}  
});`

I just want it to open in new browser window(not new tab).closebutton is the function i passed to the custom button. Need help

Upvotes: 2

Views: 8347

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8847

SuiteScript is just a library on top of JavaScript; thus, in a Client Script, you can use any normal JavaScript methods for opening a new window, e.g. https://developer.mozilla.org/en-US/docs/Web/API/Window/open

Upvotes: 1

Related Questions