I have read several posts about doing "sleep" or "wait" in Javascript. However, they all use client side Javascript. I need to do this in a Scheduled NetSuite SuiteScript. I ahve tried setTimeout() and it tells me it cannot find the function (as well as window.setTimeout()).
If I have to do an infinite loop with an if condition that gives me the delay I want, i will do that but it is less than ideal. I want to know if there is a simple "sleep" or "wait" kind of way of doing this to delay code from executing.
My purpose is because my code deletes records. In my current setup, if 2 of these records are deleted too close to one another NS throws "unexpected error" and stops. if there is a long enough pause in between, then it works. I am trying to automate this so i don't sit here deleting records all day.
The posts I have checked so far: How to create javascript delay function JavaScript.setTimeout JavaScript sleep/wait before continuing What is the JavaScript version of sleep()?
Mine is not a duplicate to any of those as they all assume Client side and are not specific to NetSuite SuiteScript. Thanks!