GlideScriptedProgressWorker runs but Script Include logic not executing (no records inserted)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi everyone,
I’m trying to execute a long-running task using GlideScriptedProgressWorker, but the Script Include logic does not seem to run. The worker record gets created in sys_progress_worker, but the code inside the Script Include is not executing.
Expected behavior:
The Script Include should insert records into the Incident table and update the progress message.
Actual behavior:
A
sys_progress_workerrecord is created.No errors appear in the logs.
No records are inserted into the Incident table.
gs.info()logs inside the Script Include do not appear.
Worker Script:
var worker = new GlideScriptedProgressWorker();
worker.setProgressName("Data Processing Task");
worker.setScriptIncludeName("CustomDataProcessor");
worker.setScriptIncludeMethod("runHeavyTask");
worker.putMethodArg("targetId");
worker.setBackground(false);
worker.start();
gs.info(worker.getProgressID());Script Include:
var CustomDataProcessor = Class.create();
CustomDataProcessor.prototype = {
initialize: function () {},
runHeavyTask: function(progress, recordId) {
var iterations = 10;
for (var i = 1; i <= iterations; i++) {
gs.info(i);
var percent = (i / iterations) * 100;
progress.setProgressPercent(percent);
progress.setMessage("Processing batch " + i + " for record: " + recordId);
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = "worker test";
gr.insert();
gs.sleep(1000);
}
progress.setMessage("Task Completed Successfully!");
},
type: 'CustomDataProcessor'
};Additional details:
Script Include is Server-side.
Script Include is Accessible from All Application Scopes.
The worker is triggered from Scripts - Background for testing.
Questions:
Is there something missing in the worker configuration?
Does
GlideScriptedProgressWorkerbehave differently when triggered from Scripts - Background?Is there a recommended way to debug worker execution?
Any help or suggestions would be greatly appreciated.
Thanks!
