Hi Everyone, I am trying to insert a line item at...
# suitescript
e
Hi Everyone, I am trying to insert a line item at the customer record where the sublist is named 'Content' below is the screenshot: The sublist is created by the script User event' BeforeLoad event which is locked by the bundle, so when I am creating the custom record by using suitelet script I am unable to insert the item line in the sublist I am getting error as below:
Copy code
{
   type: "error.SuiteScriptError",
   name: "USER_ERROR",
   message: "Items you have requested in the record have been deleted since you retrieved the form",
   stack: [
      "Error\n    at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n    at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n    at Object.afterSubmit (/SuiteScripts/GBS_UE_ValidateSkidRecord.js:158:32)"
   ],
   cause: {
      type: "internal error",
      code: "USER_ERROR",
      details: "Items you have requested in the record have been deleted since you retrieved the form",
      userEvent: null,
      stackTrace: [
         "Error\n    at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n    at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n    at Object.afterSubmit (/SuiteScripts/GBS_UE_ValidateSkidRecord.js:158:32)"
      ],
      notifyOff: false
   },
   id: "",
   notifyOff: false,
   userFacing: true
}
All I want to insert the item line into the script does anybody has any idea that why is this error can be solved??
b
your description suggests you are doing something that is doomed for failure
if the sublist is created by the beforeLoad, then trying to add to it wont work, the user event controls what goes in the sublist
e
@battk In the User event before load, the flow is Load Items from saved search-> Add that item in the sublist->Commit line
b
sounds like how sublists work in beforeLoad
trying to add a line to the sublist will do nothing
its a temporary sublist, adding to it wont do anything
it wont be saved, it wont even be displayed
e
So is there any way or it is not possible?
b
essentially you would need to understand how the beforeLoad chooses what to display