Scheduled Background Script – GlideRecordSecure() not updating Incident HTML Description field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello!
I have a scheduled background script that updates the incident.description HTML field.
Now I've read about ServiceNow scripting governance tool and I have added the admin user and all required users the snc_required_script_writer_permission role.
but still the field doesn't update.
- My script uses GlideRecordSecure() for the update
- Field-level ACL on `incident.description` requires the `sn_incident_write` role - which has also been granted to admin user
Still doesn't work.
If I switch to the standard GlideRecord(), it updates correctly.
How to make my script work without stripping the "Secure"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @NoorulHudaN ,
If it only issue with GlideRecordSecure please check in Access Analyzer for a specific user and specific record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@NagaChandaE The user in question is "System" user that is running the background script
cannot select system user in access analyzer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @NoorulHudaN ,
So basically here, GlideRecordSecure() is doing its job by enforcing ACLs. The fix is not in the script itself but in ensuring the execution context has the required role.
Scheduled jobs run as the system user, which may doesn't have your roles.
assign sn_incident_write to the system user OR run the script impersonating the user.
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @yashkamde
I thought system user runs with the highest privilege and bypasses ACLs
How to assign "System user" any role? Is that possible?
