Watz
02/03/2020, 2:57 PMSandii
02/03/2020, 3:42 PMsuitedev
02/03/2020, 4:35 PM// Sample Usage:
var singleFolderFn = 'launchFolderWindow(\'' + folderId + '\')';
var singleFolderLinkText = '<a href="#" onclick="' + getClientOnclickJS(singleFolderFn) + '"> one file</a>';
/**
* This function calls the provided function name in the Client Script Module Path.
*
* @param {string} functionName - Same format as current addButton functionName
*/
function getClientOnclickJS(functionName) {
var CLIENT_SCRIPT_MODULE_PATH = '/SuiteScripts/folder/client-script-file';
var onclickBlob = "var rConfig = JSON.parse('{}');\
rConfig['context'] = '"+ CLIENT_SCRIPT_MODULE_PATH + "';\
var entryPointRequire = require.config(rConfig);\
entryPointRequire(['"+ CLIENT_SCRIPT_MODULE_PATH + "'],\
function (mod) {\
try { \
mod."+ functionName + "\
} catch(e){\
console.log(e);\
}\
}); return false;";
return onclickBlob.replace(/\s\s\s\s/gmi, '');
}
Of Course, it is possible that NetSuite will change the way they do this , and your script will fail... :)mattdahse
02/03/2020, 5:29 PMWatz
02/17/2020, 2:55 PM