sleep function not availabe in scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-02-2018 10:16 PM
I am using server side script include to poll the ecc queue every second, for the input record to be created. I need to wait for an maximum of 25 seconds before the operation is completed. when I used gs.sleep(1000). This function is not available in scoped application. Is there any other function we can use other than sleep function. Will be grateful for any guidance or support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-04-2018 12:34 AM
Hello Gayathri,
You cannot use the sleep function in a scoped application. Here is a workaround that you could apply
1) Create a Script Include in Global Scope, Accessible from All Application Scopes
var MyGlobalScopeUtils = Class.create();
MyGlobalScopeUtils.prototype = {
initialize: function() {},
sleep: function (duration) {
gs.sleep(duration);
},
type: 'MyGlobalScopeUtils'
};
2) In your scoped script, Call this function as
var globalUtils = new global.MyGlobalScopeUtils();
globalUtils.sleep(1000);
Please try it out and let me know.
Reference post: https://community.servicenow.com/community?id=community_question&sys_id=8cdc8329db9cdbc01dcaf3231f9619e1&view_source=searchResult