Cross Scope problem I need some help with Service Portal - Standard Ticket and HR Core
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 07:09 AM
I have a widget that cancels RITMS' and the REQ when someone cancels something from Employee Center. The widget works fine but there is one small piece that does not work. The widget has in it to set the sn_hr_core_case to state = 7 (cancelled) but it's not running. I took the script and ran in it background scripts and am getting the following message:
"
Source descriptor is empty while recording access for table sn_hr_core_case: no thrown error
Security restricted: Read operation on table 'sn_hr_core_case' from scope 'Global' was denied because the source could not be found. Please contact the application admin.
Security restricted: Read operation on table 'sn_hr_core_case' from scope 'Global' was denied. The application 'Global' must declare a cross scope access privilege. Please contact the application admin to update their access requests.
I have tried to create a cross scope record for this and nothing seems to be working.
Here is the script I'm using:
var hrCase = new GlideRecord('sn_hr_core_case');
hrCase.addQuery('sys_id', '1f3c07eefbe9265076d8fc6b4eefdc78'); //this is just for now, it should get the core case from the record that it's on in the employee center but running static for testing
hrCase.query();
while (hrCase.next()){
hrCase.state = '7'; //This should cancel the HR Case
hrCase.update();
}
Does anyone know how to solve this error, or am I doing something incorrect in the widget?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 07:21 AM
did you try creating Restricted caller access record?
Restricted caller access privilege settings
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
07-14-2025 07:28 AM - edited 07-14-2025 07:29 AM
Hi Stephen,
Let’s make your code more efficient.
1. If you only want to query one record then rather than querying whole table to find a sys_id I suggest you use get() method.
2. Always use getters and setters meaning setValue() and getValue().
3. System automatically defines cross scope privilage when it is not there. You just need to allow it.
Your script should look like below:
var hrCase = new GlideRecord('sn_hr_core_case');
hrCase.get('1f3c07eefbe9265076d8fc6b4eefdc78');
hrCase.setValue('state', '7'); //This should cancel the HR Case
hrCase.update();
- When you will run above script in BG. Open 'sys_store_app' list view.
- You will find a record with target name as your HR table. You can also sort with updated and you will get your cross scope privilage record.
- Open it and change the status value to 'Allowed' and save the record.
- Try running the script again. You shouldn't get any error now.
If my answer helps then please mark it Helpful and Correct.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 11:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 11:10 PM
1. First check sn_hr_core_case table access settings and make sure it can be read by other applications.
2. Check Restricted Caller Access Privileges to see if there is new request created recently and set the request to allowed