- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:57 AM
I have a Scoped App that has a Custom Table with about 150 records in it. This has been in Production for a while. They want to add a suffix onto one of the fields for all records. The field name is called "security_group", and they want to add "- Role" to the end of every entry of this field.
I created the following Background Script to do that:
var gr = new GlideRecord('x_table_name');
gr.addQuery('active','true');
gr.query();
while(gr.next()){
gr.security_group = gr.security_group + '- Role';
gr.update();
}
when I try to run it, I get the following error messages:
Security restricted: Write operation against 'x_table_name' from scope 'rhino.global' has been refused due to the table's cross-scope access policy
I did some research, and found the following articles:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0727180
I have tried the suggestions in them, including:
1. Tried a "cache.do"
2. Tried running "gs.invalidateCache();" in the background
3. Tried checking the "Can Create" flag on the table
None of that made any difference. So I tried putting the code in a Scheduled Job, and tried running that. That still did not update the records.
Does anyone have any other ideas on how I can make these data updates quickly and efficiently (without having to edit each one manually)? I thought about exporting the records and re-importing them, but the issue is the field I am updating is the key unique field that I would be matching on! And I know it is a bit tricky to figure out how to export the sys_id into an Excel export.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 05:13 PM - edited 08-04-2025 05:18 PM
@jmiskey, here's a simple approach.
Follow the steps below.
1) First, have only one field in your list view that you wish to update with the suffix or minimum fields as possible. Like example below.
2) Then click on column context menu and select "Import". Select the options as shown in the example below and click on "Create Excel template". It will process your request and show you download button. Download the template. (Don't include all fields.)
3) This downloaded excel template will have "SysIDs" of all the filtered records along with your selected column that you chose in the list view of you custom table. See example snip below.
4) Now, all that you need to do is concatenate the 2 strings as example below and upload it back with the same interface.
5) Copy and paste the concatenated text to your desired column that you want to update. For example I used "Short Description" field. Do not change any field header. Otherwise it will fail.
6) Save your excel and upload it back from the same interface you downloaded the template.
See example below. If all goes well no error will throw. If error shows up you can fix and upload the excel again.
7) Click on "Preview imported data". Check your updates and scroll to the bottom to complete your import.
Final result...
Hope this helps.
P.S - By the way, did you try fix script? Is it throwing the same error? Not spending too much time there. Try this little trick!
Also, did you check the scope in which you're running your script?
Let me know if it worked!
Regards,
Vikas K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 05:13 PM - edited 08-04-2025 05:18 PM
@jmiskey, here's a simple approach.
Follow the steps below.
1) First, have only one field in your list view that you wish to update with the suffix or minimum fields as possible. Like example below.
2) Then click on column context menu and select "Import". Select the options as shown in the example below and click on "Create Excel template". It will process your request and show you download button. Download the template. (Don't include all fields.)
3) This downloaded excel template will have "SysIDs" of all the filtered records along with your selected column that you chose in the list view of you custom table. See example snip below.
4) Now, all that you need to do is concatenate the 2 strings as example below and upload it back with the same interface.
5) Copy and paste the concatenated text to your desired column that you want to update. For example I used "Short Description" field. Do not change any field header. Otherwise it will fail.
6) Save your excel and upload it back from the same interface you downloaded the template.
See example below. If all goes well no error will throw. If error shows up you can fix and upload the excel again.
7) Click on "Preview imported data". Check your updates and scroll to the bottom to complete your import.
Final result...
Hope this helps.
P.S - By the way, did you try fix script? Is it throwing the same error? Not spending too much time there. Try this little trick!
Also, did you check the scope in which you're running your script?
Let me know if it worked!
Regards,
Vikas K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 03:55 AM
Yes, I tried running it in both the Global scope, and the scoped app and got the same error message.
I am out of the office for an all day meeting, but I will try your suggestion tomorrow when I am back in the office.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Thank you! This was EXACTLY the type of solution I was looking for! I was not aware that you could easily create an Export template like that with the sys_id contained in it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
You're welcome!
I am glad it worked.
Yes, the feature is less explored and overlooked most of the times for such tasks.