The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Question regarding adding delay in a script

nirwan_ritik
Tera Contributor

Hi Community,

 

https://www.servicenow.com/community/developer-forum/need-delay-function-for-script/m-p/1409922

I recently stumbled across this article where @Ankur Bawiskar has suggested a way to incorporate a delay in a script. Tried it, and it is working as expected. But, few doubts not leaving from my mind.
1. Is this the correct approach?
2. Should we use this in an actual implementation (if there's no other way to satisfy the requirement)?
3. Impact on performance?

4. Any alternatives?

 

Awaiting response from community as well as Ankur 🙂

Regards,
Ritik

6 REPLIES 6

My problem statement:
I have a 3 tier ebonding scenario where a SSI system puts ticket in our parent ServcieNow, and from there, via ebonding, it creates the same ticket in another ServiceNow (vendor).

Catch is - while SSI created the incident in parent SNOW, it sends the creation work notes with a delay of around 1 minute (not sure why, asked them to stop this but didn't help). So, almost 2-3 API calls within a minute.

But, as the ebonding initiates from Parent SNOW to Vendor SNOW - the notes does not get captured by the payload builder script include

In simple language: Work notes get copied after the ebonding is established from parent to vendor (milliseconds delay). Hence get's missed!

I am trying to add a delay in the payload builder script - so that when ebonding  triggers from Parent - it wait's for a minute to capture the complete incident payload. @Ankur Bawiskar @VikMach I used the script suggested by Ankur in the article I attached - and it is working soo fine!

This particular question was just to make sure if this approach will impact my parent ServiceNow system in a very bad way 🙂

@nirwan_ritik 

As per your requirement you will require some delay, no option there.

Yes it will have some small performance impact but I believe that should be fine as your requirement cannot be done without delay

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader