{"type":"error.SuiteScriptError","name":"USER_ERRO...
# ask-stanley-ai
r
{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Invalid number (must be positive)","id":"","stack":["Error\n at RecordInvoker.setCurrentSublistValue (suitescript/resources/javascript/record/serverRecordService.js4115)\n at Function.promise (suitescript/resources/javascript/record/proxy.js11524)\n at updateItemOnWOIssueRecord (/SuiteScripts/PickerTest.js10349)\n at async pick (/SuiteScripts/PickerTest.js5334)\n at /SuiteScripts/PickerTest.js3242\n at async Promise.all (index 0)\n at async Object.onRequest (/SuiteScripts/PickerTest.js3631)"],"cause":{"type":"internal error","code":"USER_ERROR","details":"Invalid number (must be positive)","userEvent":null,"stackTrace":["Error\n at RecordInvoker.setCurrentSublistValue (suitescript/resources/javascript/record/serverRecordService.js4115)\n at Function.promise (suitescript/resources/javascript/record/proxy.js11524)\n at updateItemOnWOIssueRecord (/SuiteScripts/PickerTest.js10349)\n at async pick (/SuiteScripts/PickerTest.js5334)\n at /SuiteScripts/PickerTest.js3242\n at async Promise.all (index 0)\n at async Object.onRequest (/SuiteScripts/PickerTest.js3631)"],"notifyOff":false},"notifyOff":false,"userFacing":true}
c
AI generated answer (using internal Slack threads):
Based on the provided Slack threads, it seems that the error
{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Invalid number (must be positive)"}
is related to the way numbers are being handled in SuiteScript. In the first thread, the error
INVALID_NUMBER
was encountered when trying to update a record. The solution suggested was to use
parseInt(id,10)
instead of just
parseInt(id)
. This is because
parseInt
with only one argument tries to interpret what to do based on the format of the input string. If it starts with a 0, it tries to parse it into a base 8 number instead of a base 10. By specifying the radix with the second argument, you ensure that
parseInt
will always try to convert to a base 10 number. In the second thread, the error
INVALID_FLD_VALUE
was encountered when trying to create a purchase order. The error message indicated that the subsidiary with internal id 3 is not valid for the entity with internal id 7864. This suggests that the value being set for the subsidiary field is not valid. In the third thread, the error
INVALID_NUMBER
was encountered when trying to save a record. The solution suggested was to use the string '11612' as the id instead of the number 11612. This is because in SuiteScript 2.0, all numeric values should be set as strings. In conclusion, when dealing with numbers in SuiteScript, it's important to ensure that the values being set are valid and in the correct format. If you're encountering errors, it may be helpful to check the data types and validation settings of the fields you're working with.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.884537935
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.870989859
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.869401574
Please provide your feedback on this answer.