dmashburn3
11/26/2018, 8:23 PMfile.load
in a user event script. However I keep getting RCRD_DSNT_EXIST
. Am I doing this wrong?jkabot
11/27/2018, 5:47 PMfunction scriptFolderPath() {
var script = runtime.getCurrentScript();
var results = search.create({
type: 'script',
filters: ['scriptid', 'is', script.id],
columns: ['scriptfile']
}).run().getRange({ start: 0, end: 1 });
if (results.length === 0) {
throw new Error('Failed to look up script file.');
}
var scriptFileId = results[0].getValue('scriptfile');
var scriptFilePath = file.load({ id: scriptFileId }).path;
var lastSlash = scriptFilePath.lastIndexOf('/');
return scriptFilePath.substring(0, lastSlash);
}
// ...
var relativeFile = file.load({ id: scriptFolderPath() + '/path/to/relative_file.html' }).getContents();