Unable to insert record in table

mareks_p
Giga Contributor

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?


1 ACCEPTED SOLUTION

The SN Nerd
Giga Sage

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



table_access.PNG



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

5 REPLIES 5

Thanks. it works!