Seeing some odd behaviour in a Mass Update script....
# suitescript
e
Seeing some odd behaviour in a Mass Update script. It is effectively a mass deletion script for a specific set of records. For each record it receives, it runs 5 searches to build 5 separate lists. Each list consists of Objects with a
type
and
id
property to describe the record. Then I just delete them all like so:
Copy code
list1.forEach(deleteRecord);
list2.forEach(deleteRecord);
list3.forEach(deleteRecord);
list4.forEach(deleteRecord);
list5.forEach(deleteRecord);
where:
Copy code
function deleteRecord(obj) { r.delete(obj); }
The list-building works correctly, the deletion works correctly, but in some cases it fails due to record dependencies. There are no dependencies other than those in this specific chain, and I have the ordering correct that dependent records are deleted first and that should never happen. It's behaving like the
forEach
and/or the
delete
calls are asynchronous, but I'm not aware of that being the case. Any thoughts?