How do I make sure only one instance of my scheduled job is running at any given point of time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 03:52 AM
I have a requirement: My scoped application have a scheduled job which executes a script include whenever it runs. I need to implement singleton for this scheduled job - meaning, only one instance of that job should be running at any point of time.
How can I achieve that with servicenow?
What I had on my mind is:
Job runs and checks some place to see if another instance of it (or of that script include) is already running.
If yes, terminate yourself. If not, go ahead and do the job.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 08:31 AM
I don't use Lock all that often, but it should do the trick in this case. It prevents other instances of the workflow from continuing past the lock until after the lock is released.
http://wiki.servicenow.com/index.php?title=Utility_Activities#Lock
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 08:39 AM
Thanks Chuck. We are trying to use this functionality with no luck. The "other" lock never picks up after the first lock releases it. I've opened a ticket with SN but I have a feeling I'm missing something vital in relation to these locks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 08:42 AM
Keep me informed. I'm most interested in learning more.