- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2020 07:46 PM
Hello,
I created a business rule to allow approvers to see the attachments added to the application in the portal.(Global)
Weirdly, however, we realized that we needed to enforce this business rule before an authorization record would occur.
System log:
My boss told me to use 'gs.sleep' as a way to make this delay.(Global)
Refer to:
However, it doesn't work well.
Can you point out what is wrong?
Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2020 08:42 PM
Hi,
gs.sleep() is not allowed in scoped app; you can use this to use some delay
ms -> milliseconds
function sleep(ms) {
var endSleep = new GlideDuration().getNumericValue() + ms;
while ( new GlideDuration().getNumericValue() < endSleep) {
//wait
}
return;
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 07:49 AM
Yet another version of the Sleep function that works in scoped apps:
The DevTools app contains a truckload of reusable scripts and
features to support your app development.
Fork at will!