Get instance of GlideScriptedHierarchicalWorker via progressID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2015 09:03 PM
Hi guys,
Do you know how to get instance/record of GlideScriptedHierarchicalWorker by using progressID?
Example: I have a code for Worker like:
var worker = new GlideScriptedHierarchicalWorker();
worker.setProgressName('Import Services');
worker.setBackground(true);
worker.setScriptIncludeName('x_ausgh_snsc.SaraConsumerWorker');
worker.setScriptIncludeMethod('run');
worker.putMethodArg('targetCatId', targetCatId);
worker.start();
var progressID = worker.getProgressID();
I want to get worker in other code via progressID. So how can?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 11:44 AM
Hello! Man, I would love to get more information about this too. Did you get any more details? Mostly I'd like to be able to monitor the processes and see how many are still running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2015 02:21 AM
Hi Duc,
What about going with a GlideRecord directly to "sys_progress_worker" using the name of the job, after job has been started?
Like:
var gr = new GlideRecord("sys_progress_worker");
gr.addQuery('name', '=', 'Data Archiving');
gr.query();
while(gr.next()){
gs.print('The progress worker job state is: ' + gr.state.toString() + ' and the Completion code is: ' + gr.state_code.toString());
}
The above code gives in my case:
[0:00:00.003] Script completed in scope global: script
*** Script: The progress worker job state is: complete and the Completion code is: success
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2015 12:11 PM
What are you looking to do with the worker once you retrieve it again? I think the prefered option would be to use GlideExecutionTracker but the API is far too limited for scoped apps to do anything useful.
For example, getBySysID is the method you would need and it only works in global.
cc. Bobby Edmonds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 04:17 AM
How do I cancel a worker if it has started? Need to implement a cancel functionality.