Ankur Bawiskar
Tera Patron
Tera Patron

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

AnkurBawiskar_0-1735380954481.png

 

Output: Scoped app

AnkurBawiskar_1-1735381021258.png

 

Version history
Last update:
‎12-28-2024 02:17 AM
Updated by:
Contributors