ATF : Dynamic step timeout value

Nisar2
Mega Guru

Hi experts,

Is it possible to modify/alter a step's timeout value on the fly?

Use case scenario:

I'm using a "Run server side script" step and I'm required to wait a certain "x" seconds before gliding a table. This "x" seconds can range anywhere between 10 to 45. So in order to make sure the current step doesn't move on to the next step immediately, I'm (for now) using a hardcoded value of 70 seconds as timeout.

So my question is whether I can change the timeout value via the server side script once I glide the table after "x" seconds? For example, after 20 seconds I glide the table and get the required data. Now, instead of waiting for 70 seconds for the step to timeout, can I bypass those remaining 50 seconds of wait time by somehow telling ATF that it can move on to the next step as I got the required information that I was waiting for?

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nisar,

you can use this script to make the script wait for particular seconds before querying the table

I am using similar approach and below script in Run server side script

// wait for 10 seconds before checking email logs
	var secondsValue = 10;
	var seconds = parseInt(secondsValue, 10) * 1000;
	var start = parseInt(new Date().getTime()) + seconds;
	while(start>parseInt(new Date().getTime())){
		// do nothing
	}

// code to query the table from here

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur,

 

The problem with that approach is that if the "secondsValue" exceeds the timeout value of the step, it moves on to the next step.

And if I keep a hardcoded value of, say 20 seconds (as buffer time), as timeout value of the step and I'm done with all the processing within, say 12 seconds, I'll have to wait the additional remaining 8 seconds for the step to complete.

Hi Nisar,

That I don't think you can handle; like the additional timing part

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Nisar 

Is this answered?

if my answer helped you, kindly mark it as Correct & 👍Helpful so that it does not appear in unanswered list & close the thread.

Regards
Ankur

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