creece
03/20/2019, 6:27 PMJohn
03/20/2019, 6:32 PMdcrsmith
03/20/2019, 6:55 PMJohn
03/20/2019, 6:59 PMcreece
03/20/2019, 7:02 PMalien4u
03/20/2019, 7:25 PMfile.load
using relative path? does that really works?erictgrubaugh
03/20/2019, 7:29 PMerictgrubaugh
03/20/2019, 7:29 PMerictgrubaugh
03/20/2019, 7:29 PM/SuiteScripts/...
Kris Jones
03/20/2019, 7:32 PMinlineHTML
form field
but doing that doesn't allow(?) me to load in anything besides jQuery...ok...
so I've been trying to add a portlet.clientScriptModulePath
with a link to a client script yadda yadda yadda that imports ChartJS and jQuery from the filecabinet... but I'm not really understanding how to execute an initial load of this script that would allow for click event handlers etc.
can someone point me in the right direction?alien4u
03/20/2019, 7:32 PMdcrsmith
03/20/2019, 7:33 PMdcrsmith
03/20/2019, 7:33 PMdcrsmith
03/20/2019, 7:34 PMjkabot
03/20/2019, 7:34 PMfunction getScriptFileId(scriptId) {
var results = search.create({
type: 'script',
filters: ['scriptid', 'is', scriptId],
columns: ['scriptfile']
}).run().getRange({ start: 0, end: 1 });
if (results.length === 0) {
return '';
}
return results[0].getValue('scriptfile');
}
function getCurrentScriptFilePath() {
var scriptFileId = getScriptFileId(runtime.getCurrentScript().id);
var scriptFile = file.load({ id: scriptFileId });
return scriptFile.path;
}
function getCurrentScriptFolderPath() {
var scriptFilePath = getCurrentScriptFilePath();
var lastSlash = scriptFilePath.lastIndexOf('/');
return scriptFilePath.substring(0, lastSlash);
}
In use
var scriptFolderPath = getCurrentScriptFolderPath();
var someFile = file.load({ id: scriptFolderPath + "/relative/to/current/script_file.json" });
alien4u
03/20/2019, 7:35 PMalien4u
03/20/2019, 7:35 PMmiachel douglas
03/20/2019, 7:51 PMmiachel douglas
03/20/2019, 7:52 PMmiachel douglas
03/20/2019, 7:52 PMmiachel douglas
03/20/2019, 7:52 PMmiachel douglas
03/20/2019, 7:52 PMVtor
03/20/2019, 7:56 PMVtor
03/20/2019, 7:56 PMVtor
03/20/2019, 7:56 PMmiachel douglas
03/20/2019, 7:56 PMVtor
03/20/2019, 7:57 PMmiachel douglas
03/20/2019, 7:57 PMVtor
03/20/2019, 7:57 PMVtor
03/20/2019, 7:57 PM