scheduled job execution

dvelloriy
Kilo Sage

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();

}

 

dvelloriy_0-1741277017631.png

 

8 REPLIES 8

@dvelloriy 

yes I believe so and give the restricted caller access

OR

ensure your flow is in correct HR scope

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Flow is in HR scope only however the sys_trigger record which is getting generated as part of this flow is not updating the target HR case and the error seems to be restricted caller access.

 

 

Guido Bernuetz
Giga Guru

This is a scheduled item. You must define a schedule job (System Definition)!

GuidoBernuetz_0-1741277751403.png

 

Fill in some log statements like gs.info(....) to check if the record with that sys_id is really selected.

Enclose the code with try/catch to catch any exception.

 

 

I am not a helpful hunter.
I will always try to give a meaningful and valid answer.

thomaskennedy
Tera Guru

How do you know the script is not executing? You said that the record does not get updated, but that's not the same as the script not executing.