- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:12 AM
I am trying to do this insert from Script - Background
// Add record | |
gs.log("Add warehouse item"); | |
var gr1 = new GlideRecord('x_80267_inventory_warehouse'); | |
gr1.initialize(); | |
gr1.name = "building"; | |
gr1.insert(); | |
var ref = gr1.insert(); | |
gs.log('Added item id: ' + ref); |
and getting this error
[0:00:00.003] Script completed in scope global: script
*** Script: Add warehouse item
Security restricted: Create operation against 'x_80267_inventory_warehouse' from scope 'rhino.global' has been refused due to the table's cross-scope access policy
Security restricted: Create operation against 'x_80267_inventory_warehouse' from scope 'rhino.global' has been refused due to the table's cross-scope access policy
*** Script: Added item id: null
I have write permissions in attachment.
Any idea what is missing and not working for me?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:29 AM
If you want to be able to create records in Global, you'll need to change the access levels on the table.
System Definition > Tables
Name = x_80267_inventory_warehouse
Open the Table record
Navigate to Application Access
Set 'Accessible from' to "All application scopes"
Set 'Can create' to TRUE
Save the record
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:21 AM
Hi Markeks,
Have you tried switching the scope at the bottom of the back ground scripte
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:30 AM
Yes, it works. But I am using code as a part of Unit test, and it is not working in that scope, that why I was thinking that I need permissions to make insert from any scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:24 AM
Im just guessing here, but it seems that when your'e using scripts - background your in the "global" scope, and then you try to insert records in your scoped application. Have you chosed the application in your application picker? So it doesn't say global there?
//Göran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:29 AM
If you want to be able to create records in Global, you'll need to change the access levels on the table.
System Definition > Tables
Name = x_80267_inventory_warehouse
Open the Table record
Navigate to Application Access
Set 'Accessible from' to "All application scopes"
Set 'Can create' to TRUE
Save the record
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022