Issue: Background Task Cancellation and Multiple Task Prevention
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2025 06:46 AM
So I'm creating a background task which will be long running and the users will be seeing a progress bar which clicking on sync. It runs in the background perfectly however I'm unable to find a workaround to cancel the task.
This behavior is problematic because it can result in:
Multiple background tasks consuming system resources unnecessarily.
Inconsistent states and potential conflicts between tasks.
A poor user experience, where tasks may be duplicated or fail to cancel gracefully.
Sharing the code snippet below
I need to understand how do i cancel the ongoing background task. Hence the try block in cancel is empty. Looking forward to further guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 07:03 AM
Where is 'GlideScriptedHierarchicalWorker' documented?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2025 07:23 AM
I've done some testing, and I see a record is created in the sys_trigger table. And I've found a solution for that here:
script-for-kill-schedule-jobs-running
You can try finding the record for your job there and then call the API mentioned to kill the job.
Maybe you'll get a response to your post on the 10 year old thread.