Ankur Bawiskar
Tera Patron
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-28-2024 02:17 AM
Many a times there is a need to add some delay in your script in server side.
Below script will work in both global + scoped app. The value passed is duration value. I passed 10 seconds in duration format. It can be customized as per your requirement.
Script:
gs.info('Before delay->' + new GlideDateTime().getValue());
var now = new GlideDateTime();
while(GlideDateTime.subtract(now, new GlideDateTime()) < "1970-01-01 00:00:10") {
// loop for 10 seconds}
gs.info('After delay->' + new GlideDateTime().getValue());
Output: Global scope
Output: Scoped app
- 996 Views