Instead of gs.sleep(delayInSeconds * 1000); what is the exact function i have to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:13 AM
Hi Team,
Can you please suggest what are the exact function we have to use instead of
I have tried with this script also, but no use.
My requirement is send mails one by one, but each sending mail give 1 minute delay. I have tried the script is. It is working as expected but impacting the system performance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:24 AM
this works in scoped app
var secondsValue = 10;
var seconds = parseInt(secondsValue, 10) * 1000;
var start = parseInt(new Date().getTime()) + seconds;
while(start>parseInt(new Date().getTime())){
// do nothing
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:26 AM - edited 12-18-2024 06:29 AM
Hi @Ankur Bawiskar Sir, it is work in Global application also? and I have tried sir, it was also impacting the system performance until execute all mails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:37 AM
Any delay being set in code will cause performance issues, because you keep the code in wait and then let it do something after it waits and does something again. Your code is running the entire time until it's done.
What is the business case that you need wait periods between the emails being send?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 07:02 AM - edited 12-18-2024 07:05 AM
Hi @Mark Manders , my business requirement is sent mails to all delegate users.
Send one by one but give delay of 10 minutes of each sending mail.
when using gs.sleep it is working as expected but it impacting the total system performance.
So please suggest what i have to use Instead of 'gs.sleep'.