
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2016 07:21 AM
I have a script that I need to run on occasion. In certain circumstances I need to run another piece of the code but I need there to be a delay so that any events triggered by the code before are processed first. So what I'm looking for is an easy way to run a delayed impromptu script and when I say delayed I mean by several minutes. I know I can create a record in sys_trigger but it just seams to me with GlideRunScriptJob there should be a way to feed it or something else the script code and a date/time to run it at.
Anyone have any thoughts?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2016 07:27 AM
Consider using gs.eventQueueScheduled() to tell it what time to trigger the event and then put your code in a script action.
Avoid using the gs.sleep() method as it has been deprecated and can tie up system resources while it waits for the timer to expire (definitely a bad practice.)
If you are using a workflow, you can use a Timer activity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2016 07:28 AM
You can set this script up as a scheduled job and use the "On Demand" interval. It will just sit there until you need it and you just click "Execute Now" when you need it. Or you can set it to run x mins in the future so you can run the other script first.