scheduled job execution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 08:06 AM
Hello All
I have a scheduled job which is getting triggered however it is not executing the script. Please find the snapshot below.
As per script, it should update the target HR case from suspended to work in progress and update the assignment group as well. However that is not happening.
Can someone please advise? Can we validate why its not working, is there something wrong with script or is it cross scope issue?
Script:
var gr = new GlideRecord("sn_hr_core_case_workforce_admin");
if (gr.get("0710fb561bc8a2d08dc18402604bcbcd"))
{ gr.assignment_group = "2c52d0031bb98ed0e89734cf034bcb99";
gr.state=10;
gr.assigned_to="";
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 08:08 AM
can you try this and see what came in logs?
scheduled job is in which scope?
any cross scope error?
var gr = new GlideRecord("sn_hr_core_case_workforce_admin");
if (gr.get("0710fb561bc8a2d08dc18402604bcbcd"))
{
gs.info('Record found');
gr.assignment_group = "2c52d0031bb98ed0e89734cf034bcb99";
gr.state = 10;
gr.assigned_to = "";
gr.update();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 08:17 AM
Hi Ankur,
I inserted the logs. and see below error in the logs. I dont see "Record found".
**Source descriptor is empty while recording access for table sn_hr_core_case_workforce_admin: no thrown error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 08:26 AM
job is configured in which scope?
Please create a scheduled job like this in correct HR scope. It seems your script is not in correct HR scope
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 08:34 AM
Ankur,
Job is in global scope I guess. I am creating the schedule using the flow variable you suggested earlier. How can i change the scope here?
Do you think we might have to change the strategy here and make a call using a scirt include instead and create restrict caller access for that script include?
Please advise.
Here is the script: