- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 04:13 AM
Hi,
I want a delay of 10 seconds in my scripted REST API Script.
It is working through gs.sleep() - my usecase is to wait for sc_task to be generated after creation of RITM.
But, since this is not a best practice to use gs.sleep() , I want an alternative approach to implement.
Can anyone help on this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 04:31 AM
Hi @mansigoel ,
You can use:
var startTime = new Date().getTime();
var delay = 10000; // Simulating a delay of 10 seconds
while (new Date().getTime() < startTime + delay) {
// Simulating the delay
}
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Thanks,
Amitoj Wadhera
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 04:56 AM
Hi @mansigoel,
Please explain in detail.
- Is third party system calling your API and you want to delay the response for 10 secs? Delaying API response is not advisable. We should
- Or you are calling an API from Workflow or BR? Please explain how you are calling them.
Palani
