This topic contains 5 replies, has 0 voices, and was last updated by TheUsualSuspect 6 years, 5 months ago.

  • Author
    Posts
  • #17782

    TheUsualSuspect

    Trying to create a bank deposit in a Map / Reduce script and I am getting the error:

    “document” is not defined. (NLRecordScripting.scriptInit$lib#582)”

    This seems to be some internal NetSuite functionality trying to reference the DOM but its server side code? Line 142 below is where the script blows up.

    136 var nextRecord = record.create({ type: ‘deposit’, isDynamic: true, defaultValues: { disablepaymentfilters: true } });

    137 nextRecord.setValue({ fieldId: ‘customform’, value: 1 });

    138 nextRecord.setValue({ fieldId: ‘account’, value: bankAccount });

    139 nextRecord.setValue({ fieldId: ‘trandate’, value: this.tranDate });

    140 nextRecord.selectLine({ sublistId: ‘payment’, line: 0 });

    141 nextRecord.setCurrentSublistValue({ sublistId: ‘payment’, fieldId: ‘id’, value: paymentRec });

    142 nextRecord.setCurrentSublistValue({ sublistId: ‘payment’, fieldId: ‘deposit’, value: true });

    143 nextRecord.commitLine({ sublistId: ‘payment’, line: 0 });

    144 return nextRecord.save({ enableSourcing: true, ignoreMandatoryFields: true });

    Here is the stack trace

    {

    “type”: “error.SuiteScriptError”,

    “name”: “UNEXPECTED_ERROR”,

    “message”: “ReferenceError: “document” is not defined. (NLRecordScripting.scriptInit$lib#582)”,

    “stack”: [“anonymous(N/serverRecordService)”, “(/SuiteScripts/Test Harness/TFCS_TestHarnessScenario_LIB.js:142)”, “createRecord(/SuiteScripts/Test Harness/TFCS_TestHarness_LIB.js:132)”, “reduce(/SuiteScripts/Test Harness/TFCS_TestHarness_MR.js:97)”],

    “cause”:

    {

    “type”: “internal error”,

    “code”: “UNEXPECTED_ERROR”,

    “details”: “ReferenceError: “document” is not defined. (NLRecordScripting.scriptInit$lib#582)”,

    “userEvent”: null,

    “stackTrace”: [“anonymous(N/serverRecordService)”, “(/SuiteScripts/Test Harness/TFCS_TestHarnessScenario_LIB.js:142)”, “createRecord(/SuiteScripts/Test Harness/TFCS_TestHarness_LIB.js:132)”, “reduce(/SuiteScripts/Test Harness/TFCS_TestHarness_MR.js:97)”],

    “notifyOff”: false

    },

    “id”: “”,

    “notifyOff”: false

    }
    This is a cached copy. Click here to see the original post.

  • #17783

    michoel

    Do you have any client scripts deployed to your Deposit record? NetSuite could be trying to execute it server side when it creates the new record.

  • #17784

    TheUsualSuspect

    Originally posted by michoel

    View Post

    Do you have any client scripts deployed to your Deposit record? NetSuite could be trying to execute it server side when it creates the new record.

    There are no scripts or workflows listed in the scripted records page for the deposit record.

  • #17785

    michoel

    It definitely does smell like a NetSuite defect

    Have you tried creating the record in standard mode instead of dynamic?

  • #17786

    TheUsualSuspect

    Originally posted by michoel

    View Post

    It definitely does smell like a NetSuite defect

    Have you tried creating the record in standard mode instead of dynamic?

    Yeah I was pretty sold on it being a defect, the stack trace blows up in their source code file so its not anything i’m doing.

    IIRC I was having to use dynamic mode because I couldn’t get standard mode to work with cash sale payments when a non default subsidiary / bank account was being used. Could be a configuration detail I was missing or just apart of the weirdness of this record / sublist in 2.0 but I switched to dynamic mode and it works except for the rare and intermittent error above.

  • #17787

    TheUsualSuspect

    I was hoping to get a NetSuite resources’ two cents on this and have them confirm if this looks like a NetSuite bug


    rnedelkow replied on 06/19/2018, 03:17 PM: I haven’t seen anything recently with that specific error but judging by previous cases, a Defect was was filed for those. I’d file a case in the meantime and let Support make that determination.

You must be logged in to reply to this topic.