ehcanadian
01/17/2019, 2:30 PMcontext.request
in a UE beforeLoad
, and I am getting an error type":"error.SuiteScriptError","name":"TypeError","message":"Cannot read property \"getAllParameters\" from undefined"
. Should I take it as a fluke? I'm checking params as if (context.request.parameters && context.request.parameters.projtask)
stalbert
01/17/2019, 3:29 PMstalbert
01/17/2019, 3:30 PMstalbert
01/17/2019, 3:31 PMehcanadian
01/17/2019, 3:39 PMjkabot
01/17/2019, 3:39 PMjkabot
01/17/2019, 3:41 PMehcanadian
01/17/2019, 6:55 PMehcanadian
01/17/2019, 6:55 PM{
"type": "error.SuiteScriptError",
"name": "TypeError",
"message": "Cannot read property \"getMethod\" from undefined",
"stack": [
"createError(N/error)",
"beforeLoad(/SuiteScripts/BMI_UE_BPMSTimeBill.js:123)",
"createError(N/error)"
],
"cause": {
"message": "Cannot read property \"getMethod\" from undefined",
"fileName": "/SuiteScripts/BMI_UE_BPMSTimeBill.js",
"lineNumber": 123,
"name": "TypeError",
"stack": "\tat /SuiteScripts/BMI_UE_BPMSTimeBill.js:123 (beforeLoad)\n\tat INVOCATION_WRAPPER$sys:27\n\tat INVOCATION_WRAPPER$sys:19\n\tat INVOCATION_WRAPPER$sys:37\n\tat INVOCATION_WRAPPER$sys:1\n",
"rhinoException": "org.mozilla.javascript.EcmaError: TypeError: Cannot read property \"getMethod\" from undefined (/SuiteScripts/BMI_UE_BPMSTimeBill.js#123)"
},
"notifyOff": false,
"userFacing": true
}
ehcanadian
01/17/2019, 6:56 PMstalbert
01/17/2019, 6:58 PMehcanadian
01/17/2019, 7:00 PMstalbert
01/17/2019, 7:00 PMehcanadian
01/17/2019, 7:00 PMstalbert
01/17/2019, 7:01 PMbeforeLoad
is firedstalbert
01/17/2019, 7:02 PMehcanadian
01/17/2019, 7:03 PMCREATE
, I wonder if they're doing something I'm not aware ofstalbert
01/17/2019, 7:03 PMctx
object provided by NS is wrong, at least when scripts are triggered by another script indirectly. I've never seen this issue on a direct use (e.g. beforeLoad() running when record is loaded via UI)jkabot
01/17/2019, 7:04 PMrequest
the before load for the server creating/loading a record probably would notehcanadian
01/17/2019, 7:04 PMstalbert
01/17/2019, 7:05 PMundefined
in that error... maybe the ctx.request is actually undefined and it's a NS bug that's trying to access it?ehcanadian
01/17/2019, 7:06 PMehcanadian
01/17/2019, 7:06 PMN/log
isn't loaded through loljkabot
01/17/2019, 7:08 PMnlobjRequest
and since so much of SS2 is a wrapper around SS1 I imagine that when you do ctx.request.paramters
it delegates it to private_nlobjRequest.getAllParameters()
but in this case private_nlobjRequest
is undefined/nulljkabot
01/17/2019, 7:08 PMstalbert
01/17/2019, 7:09 PMstalbert
01/17/2019, 7:09 PMehcanadian
01/17/2019, 7:10 PMstalbert
01/17/2019, 7:10 PMjkabot
01/17/2019, 7:10 PMif (!private_nlobjRequest) {
throw new Error('There is no request for this before load user event');
}
stalbert
01/17/2019, 7:11 PMstalbert
01/17/2019, 7:11 PMrequest
is undefined if the script is serverside?stalbert
01/17/2019, 7:11 PMjkabot
01/17/2019, 7:11 PMstalbert
01/17/2019, 7:12 PMstalbert
01/17/2019, 7:13 PMjkabot
01/17/2019, 7:14 PMehcanadian
01/17/2019, 7:14 PMjkabot
01/17/2019, 7:15 PMfunction hasRequest() {
try {
ctx.request.parameters;
return true;
} catch(exc) {
return false;
}
}
stalbert
01/17/2019, 7:48 PMstalbert
01/17/2019, 7:48 PMehcanadian
01/17/2019, 7:58 PMehcanadian
01/17/2019, 7:59 PMstalbert
01/17/2019, 8:00 PMjkabot
01/17/2019, 8:01 PMehcanadian
01/17/2019, 8:02 PMjkabot
01/17/2019, 8:03 PMget filterExpression() {
return copyOfInternalArray();
}
I was trying to add some filters like
sea.filterExpression.push('AND', ['internalid', 'anyof', [whatever]]);
but that was modifying the copy of the internal array that was passed to mejkabot
01/17/2019, 8:04 PMehcanadian
01/17/2019, 8:05 PMjkabot
01/17/2019, 8:06 PMehcanadian
01/17/2019, 8:08 PMehcanadian
01/17/2019, 9:46 PMruntime.executionContext
is USEREVENT
...jkabot
01/17/2019, 10:16 PMstalbert
01/17/2019, 11:04 PMehcanadian
01/18/2019, 1:26 AMstalbert
01/18/2019, 6:15 AMstalbert
01/18/2019, 6:16 AMehcanadian
01/18/2019, 4:00 PM