KevinJ of Kansas
01/06/2020, 6:15 PMFail to evaluate script: All SuiteScript API Modules are unavailable while executing your define callback.
aaron_tekton
01/06/2020, 6:16 PMreturn
object that were directly referencing a module. For example return { userId: runtime.getCurrentUser().id }
. That was only an issue when editing SuiteScript 2.1 scripts, though. It doesn’t give the error in SS2.0battk
01/06/2020, 6:19 PMbattk
01/06/2020, 6:19 PMKevinJ of Kansas
01/06/2020, 6:21 PMKevinJ of Kansas
01/06/2020, 6:25 PM/**
* @author FrustratingDeveloper
* @date 10/24/2019
* @description
* @NApiVersion 2.0
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
* @NAmdConfig /SuiteScripts/RSM/Library/RSM_AmdConf.json
*/
define(['NB', 'RSM_CR13', 'N/search', 'N/record', 'N/runtime', 'N/error', 'N/task'],
function ( NB, RSM, search, record, runtime, error, task) {
/**
* Marks the beginning of the Map/Reduce process and generates input data.
*
* @typedef {Object} ObjectRef
* @property {number} id - Internal ID of the record instance
* @property {string} type - Record type id
*
* @return {Array|Object|Search|RecordRef} inputSummary
* @since 2015.1
*/
KevinJ of Kansas
01/06/2020, 6:25 PMcreece
01/06/2020, 6:27 PMcreece
01/06/2020, 6:28 PMcreece
01/06/2020, 6:28 PMbattk
01/06/2020, 6:32 PMbattk
01/06/2020, 6:33 PMbattk
01/06/2020, 6:34 PMKevinJ of Kansas
01/06/2020, 6:34 PMKevinJ of Kansas
01/06/2020, 6:35 PMKevinJ of Kansas
01/06/2020, 6:36 PMKevinJ of Kansas
01/06/2020, 6:37 PMjkabot
01/06/2020, 6:38 PMgetInputData
, map
, reduce
, or summarize
that makes use of any member, even non-callable members of N/xxx
modulesjkabot
01/06/2020, 6:39 PM'NB', 'RSM_CR13'
aaron_tekton
01/06/2020, 6:39 PMdefine
, yes, including ones that aren’t added to the return object.battk
01/06/2020, 6:39 PM/**
*@NApiVersion 2.0
*@NScriptType Suitelet
*/
function imValid() {
log.debug("i will work", "but am really weird");
}
define([], function() {
return {
onRequest: function() {
imValid();
}
};
});
battk
01/06/2020, 6:40 PMbattk
01/06/2020, 6:40 PMKevinJ of Kansas
01/06/2020, 6:41 PMjkabot
01/06/2020, 6:42 PMdefine(["N/record"], function(record) {
var someTypes = {
// accessing record.Type is invalid because it accessed while the someTypes object is initialzied, outside the callstack of getInputData
salesorder: record.Type.SALES_ORDER
};
function getInputData() {
// accessing record.load and record.Type are valid because they are accessed within the callstack of getInputData
record.load({
type: record.Type.SALES_ORDER,
id: ...
});
}
...
});
KevinJ of Kansas
01/06/2020, 6:48 PMKevinJ of Kansas
01/06/2020, 6:50 PMbattk
01/06/2020, 6:50 PMbattk
01/06/2020, 6:50 PMbattk
01/06/2020, 6:50 PM/**
* @NApiVersion 2.0
* @NScriptType MapReduceScript
*/
define(["N/record"], function(record) {
var someTypes = {
salesorder: record.Type.SALES_ORDER
};
function getInputData() {
return [someTypes];
}
function map(context) {
log.debug("i should be salesorder", context.value);
}
return {
getInputData: getInputData,
map: map
};
});
jkabot
01/06/2020, 6:56 PMbattk
01/06/2020, 6:57 PMjkabot
01/06/2020, 6:57 PMbattk
01/06/2020, 6:59 PMjkabot
01/06/2020, 6:59 PMjkabot
01/06/2020, 7:02 PMcreece
01/06/2020, 7:21 PMKevinJ of Kansas
01/06/2020, 7:27 PMKevinJ of Kansas
01/06/2020, 7:28 PMcreece
01/06/2020, 7:28 PMKevinJ of Kansas
01/06/2020, 7:29 PMKevinJ of Kansas
01/06/2020, 7:29 PMcreece
01/06/2020, 7:29 PMKevinJ of Kansas
01/06/2020, 7:29 PMcreece
01/06/2020, 7:29 PMKevinJ of Kansas
01/06/2020, 7:30 PMbattk
01/06/2020, 8:01 PMKevinJ of Kansas
01/06/2020, 8:01 PMKevinJ of Kansas
01/06/2020, 8:01 PMKevinJ of Kansas
01/06/2020, 8:02 PMKevinJ of Kansas
01/06/2020, 8:06 PMbattk
01/06/2020, 8:06 PMdefine(['NB', 'RSM_CR13', 'N/search', 'N/record', 'N/runtime', 'N/error', 'N/task'],
function ( NB, RSM, search, record, runtime, error, task)
battk
01/06/2020, 8:07 PMbattk
01/06/2020, 8:07 PMbattk
01/06/2020, 8:07 PMKevinJ of Kansas
01/06/2020, 8:09 PMbattk
01/06/2020, 8:11 PMbattk
01/06/2020, 8:11 PMstalbert
01/08/2020, 4:12 PM