How to wait for a certain time in BR script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2018 09:05 AM
Dear,
In a business script I need to check the Status of conference call in table conference_call.
This status will be updated automaticaly by Notify.
As I am not receiving an event when status gets updated, I need to make a kind of pulling on the table and its status like as below :
var status= new glidercord("conference_call");
status.AddQuery("status","cancel");
status.query();
I need to execute this code above every 5 seconds, then if I reach 30second = 6 ready and did not get correct status then stop.
Any idea how to do that ?
regards
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2018 09:23 AM
Hi,
gs.sleep() is the method that will work for you
Caution: If I were you, I will trigger an event, fire a script action code 6 times in a loop using gs.sleep(). If you put gs.sleep() directly in BR, it will block thread for unnecessary 30 seconds ( worst case ) and may cause perf issues.
Note: Please mark reply as correct /helpful if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2018 10:09 AM
My goal is to perfoem the followinf scnenario :
I have in a table 6 people with a phone number which are kind of rescue people.
Then my process goes as below :
- from mw BR script I made a call using notify to first pesonA (CallA)
- Then I check the conference_call table for status='inprogress'
- if 30s elapse and status is not 'Inprogress' , it meqn peopleA no answer
- Then I cancel CallA
-Then I call next peson in the list CallB and start same process again
Do ou have sample script on teh way i could handle this ?
The key thing is not doing the call as this work but more having a loop on checking the status of the call by admitting that after 30s people do not answer is stqtus hqs not change
How would you do it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2018 12:46 AM
Hi,
I can definitely help you with the logic here
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_SGSYS-eventQSched_S_O_S_S_O
You first fire and event using eventQueueScheduled API highlighted above. This event will be processed after 30 seconds and will check if status is in progress via SCRIPT ACTION. If call status is not yet "in progress", you fire an another event using same API and run SCRIPT ACTION again. You can certainly control the number of times this has to happen via EVENT parameters supported via API
Note: Please mark reply as correct / helpful if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2018 02:58 AM
Thanks for trying to help me.
I have check the link you mentionned but get confuse I do not know how to use it never done this before
What I need is monitor the call status to change.
If status change to inprogress that mean people answer teh phone so no need to wait for 30 seconds
If after 30 s status is not Inprogress then I skip the call and do an other one
Could you describe step by step what should I do ?
capture will help
One importqnt thing is that if I need to cancel the call, I need to have access to the call object OR beeing able to send a flag or qn Event to the call workflow to stop the call
Sorrw to disturb oping we can do it with your help