Boris Yasen
11/10/2022, 6:18 PMdefine(['N/currentRecord', 'N/record'],
(currentRecord, record) => {
const token = "API";
const apikey = "KEY";
const beforeSubmit = (scriptContext) => {}
return {beforeSubmit}
});
Somehow this worked before, but when I try to save it without any change, now it shows me an error that Fail to evaluate script: All SuiteScript API Modules are unavailable while executing your define callback.
Could anyone help me please?creece
11/10/2022, 6:21 PMBoris Yasen
11/10/2022, 6:22 PMdbarnett
11/10/2022, 8:12 PMBoris Yasen
11/11/2022, 3:15 PMBoris Yasen
11/11/2022, 3:16 PMdefine(['N/currentRecord', 'N/record', './config'],
(currentRecord, record, config) => {
const token = config.getOptions();
const apikey = "KEY";
const beforeSubmit = (scriptContext) => { // Use that token}
return {beforeSubmit}
});
So full code snippet is here.dbarnett
11/11/2022, 3:20 PMconfig.getOptions()
inside entry point function (if your custom config module itself calls Suitescript Api modules within likely)