I am currently experiencing an issue with the N/re...
# suitescript
e
I am currently experiencing an issue with the N/record module. record.delete is giving me trouble and throwing the error "load: Missing a required argument: id". However I am setting the record id that I wish to delete. I have used this script in the past to clean up some records and have not changed it for a while. And now I am getting an error for some reason. Any one else experience this or have a work around. Code snippet below to show I am not crazy
Copy code
//======================================================
 // WARNING : NO GOING BACK
 //======================================================
 if(oktoDelete === true){
     var isDeleted = record.delete({
        type: runtimeConfig.recordType,
        id: internalId,
     });
     log.audit("Record "+internalId, runtimeConfig.recordLabel+" "+publicRecordId+" - Deleted");
  }
e
What Script Type is this?
e
Scheduled
e
If I had to guess, whatever record type you're trying to delete has a User Event deployed to it which is triggered by your
delete()
call. The error message indicates a call to
record.load()
is failing with no
id
parameter, so look for that
☝️ 1
e
thanks for the tip. I will take a look and see if I can debug it that way. I guess the only question I have with this theory is, why would a delete operation trigger a beforeLoad, beforeSubmit or afterSubmit callback on the same record. But still worth a try
Also when I do a delete operation of the record through the UI no error is thrown
e
delete
operations always trigger User Events, so long as they're not called from another User Event. Perhaps the UE doesn't run in the UI context, or doesn't run for your User/Role
e
@erictgrubaugh That was it. I disabled the UEs and Clients to be safe and it worked like a charm. Thats why you're the Man!
1