If you really need to load by relative path you ca...
# suitescript
j
If you really need to load by relative path you can get the path to the currently executing script file with a combination of N/runtime and N/search
Copy code
function 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
Copy code
var scriptFolderPath = getCurrentScriptFolderPath();
var someFile = file.load({ id: scriptFolderPath + "/relative/to/current/script_file.json" });