Hi all,
I created a custom record with a custom sublist and am having some trouble scripting with it. Wondering if anyone might be able to help me as I try to debug this.
The error is as follows:
{"type":"error.SuiteScriptError","name":"MAD_RECORD_ERROR","message":"An error occurred while updating or creating the MAD record: You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.","id":null,"stack":["createError(N/error)","updateOrCreateMADRecord(/SuiteScripts/AssetDisposal.js:224)"
Attached is my script:
The error is focused on the updateOrCreateMADRecord function, where it searches for an existing Monthly Asset Disposal record and either creates a new or updates an existing one if one exists for this month.
It then attempts to and fails to add lines in the sublist of the record that detail the various FAM Asset records that need to be deleted at the end of the month.
The sublist should definitely be dynamic, I'm not sure where this setting is but I also have the record marked as inline editable, so don't know what else it could be.
Here's the setup of the sublist record:
Here's an example of a MAD and MAD Sublist record
Going to continue with this and see what lines my script is trying to access, if that doesn't match up or what.
If you do notice anything that might be off, please let me know. Thanks for the help!