I have a User Event Script for an Invoice record (newRecord), stored as var record
. In sandbox and in the browser console I use record.getSublistFields('sublist_name')
which has always worked.
We just ported the User Event Script from sandbox to production and suddenly getSublistFields('sublist_name')
doesn't work in the context of the script, despite there being no changes to the script. The method still works just fine using the console.
Here's a few lines from the debugger-
$ record.getLineCount('item')
> 2
$ record.getSublistFields('item')
>
$ record.getSublistFields()
> {"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"DeferredDynamicRecord.getSublistFields: Missing a required argument: sublistId","stack":["<anonymous>(N/record/recordService.js)","<anonymous>()","buildBodyData(usereventscript.js$72$debugger.user:118)","buildData(usereventscript.js$72$debugger.user:74)","_put(usereventscript.js$72$debugger.user:37)","_afterSubmit(usereventscript.js$72$debugger.user:14)","<anonymous>(usereventscript.js$72$debugger.wrap:18)","<anonymous>(usereventscript.js$72$debugger.wrap:12)","<anonymous>(usereventscript.js$72$debugger.wrap:24)","<anonymous>(usereventscript.js$72$debugger.wrap:1)"],"cause":{"type":"internal error","code":"SSS_MISSING_REQD_ARGUMENT","details":"DeferredDynamicRecord.getSublistFields: Missing a required argument: sublistId","userEvent":"aftersubmit","stackTrace":["<anonymous>(N/record/recordService.js)","<anonymous>()","buildBodyData(usereventscript.js$72$debugger.user:118)","buildData(usereventscript.js$72$debugger.user:74)","_put(usereventscript.js$72$debugger.user:37)","_afterSubmit(usereventscript.js$72$debugger.user:14)","<anonymous>(usereventscript.js$72$debugger.wrap:18)","<anonymous>(usereventscript.js$72$debugger.wrap:12)","<anonymous>(usereventscript.js$72$debugger.wrap:24)","<anonymous>(usereventscript.js$72$debugger.wrap:1)"],"notifyOff":false},"id":"","notifyOff":false} (SYSTEM_LIBS$debugger.sys#3387)
Specifically, this is an Invoice record, and as you can see from the debugger code, other regular SuiteScript 2.0 commands are working fine.
Thanks in advance for the help! Please let me know if there is any additional information I can provide.