Closing a catalog Task using ATF with sleep?

DefinitelyNotTh
Giga Contributor

Hey I had a quick question: I know that it is possible to close a catalog task by : Request Item.state : is : Closed Complete. I had a similar situation but was a little different here is the scenario.

 

So I am automating the flow of a catalog item, this catalog item goes through anywhere from 1-5 approvals all dependent on the one before it (just for reference). For these catalog items after the requests are fully approved our Service Layer integration brings in an assignment group (this process can take anywhere from 2-10 minutes). After this group is assigned I want to change the task to 'Closed Complete' from Open. 


The problem I think I will face is that this will all happen from 1 automation suite/ test run this would essentially be the last step. So i think i will face a problem if I close complete the task before an assignment group is assigned I want to have a check to make sure an assignment group is assigned then it will have to close complete the task.

The problem I think I will be face is it will try to close the task right away instead of waiting 5minutes or so is there anywhere in the test script to have the system wait? and then check or keep checking until the assignment group is assigned to close the task?

 

Another alternative I was thinking was probably trying to script something up in Javascript where say the script will essentially go through all requests and close them once a fulfillment group has been assigned. Still doing POC all insight will be helpful. Thank you!

1 ACCEPTED SOLUTION

bbf3562
Kilo Guru

Have you tried to use ATF step called "Run Server Side Validation Script"?

If not then you can try that step and add the sleep code like this,

(function(outputs, steps, stepResult, assertEqual) {
    gs.sleep(10000); // Sleep for 10 seconds

})(outputs, steps, stepResult, assertEqual);

That example script will make the ATF wait for 10 seconds before doing the next step. That way can help RITM workflow finish the process to go next stage before ATF goes on. You can modify the code from 10 seconds to minute.

 

Please mark Helpful or Solved if that answered your question.

View solution in original post

3 REPLIES 3

bbf3562
Kilo Guru

Have you tried to use ATF step called "Run Server Side Validation Script"?

If not then you can try that step and add the sleep code like this,

(function(outputs, steps, stepResult, assertEqual) {
    gs.sleep(10000); // Sleep for 10 seconds

})(outputs, steps, stepResult, assertEqual);

That example script will make the ATF wait for 10 seconds before doing the next step. That way can help RITM workflow finish the process to go next stage before ATF goes on. You can modify the code from 10 seconds to minute.

 

Please mark Helpful or Solved if that answered your question.

Hey bbf3562,

 

Is there anyway to send private messages? Have another question think that you can help me with!

SaschaWildgrube
ServiceNow Employee
ServiceNow Employee

Yet another version of the Sleep function that works in scoped apps:

https://github.com/saschawildgrube/servicenow-devtools/blob/master/update/sys_script_include_88eb276...

The DevTools app contains a truckload of reusable scripts and
features to support your app development.

Fork at will!