Scheduled Background Script – GlideRecordSecure() not updating Incident HTML Description field

NoorulHudaN
Tera Contributor

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"

14 REPLIES 14

NagaChandaE
Mega Sage

Hi @NoorulHudaN ,

If it only issue with GlideRecordSecure please check in Access Analyzer for a specific user and specific record. 
 

@NagaChandaE The user in question is "System" user that is running the background script
cannot select system user in access analyzer

yashkamde
Mega Sage

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.

Hi @yashkamde 
I thought system user runs with the highest privilege and bypasses ACLs
How to assign "System user" any role? Is that possible?