<@U5TF1GQ20> My experience is that ``` form.addBut...
# suitescript
j
@battk My experience is that
Copy code
form.addButton({
	id: 'custpage_submit',
	label: 'Submit',
	functionName: 'submit'
});
form.clientScriptModulePath = './clientscript';
emits a button with an onclick that looks like
Copy code
onclick="require(['/path/to/clientscript'], function(clientscript) {
  clientscript.submit();
})"
No need for globals
b
You are right
however it looks much uglier than what you had
var  rConfig =  JSON.parse( '{}' ) ; rConfig['context'] = '/SuiteScripts/action'; var entryPointRequire = require.config(rConfig); entryPointRequire(['/SuiteScripts/action'], function(mod){ try{    if (!!window)    {        var origScriptIdForLogging = window.NLScriptIdForLogging;        var origDeploymentIdForLogging = window.NLDeploymentIdForLogging;        window.NLScriptIdForLogging = 'customscript82';        window.NLDeploymentIdForLogging = 'customdeploy1';    }mod.onClick();}finally{    if (!!window)    {        window.NLScriptIdForLogging = origScriptIdForLogging;        window.NLDeploymentIdForLogging = origDeploymentIdForLogging;    }} }); return false;
j
Yeah 😆