We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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"

3 REPLIES 3

NagaChandaE
Kilo Sage

Hi @NoorulHudaN ,

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

yashkamde
Kilo 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.

Tanushree Maiti
Giga Sage

Hi @NoorulHudaN 

 

Add the user to conditional script writer group. It should work after that ( not tested at my end).

 

Refer KB2581331  : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2581331

       also refer: https://www.servicenow.com/community/app-engine-forum/issue-with-html-field-users-can-t-update-value....

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: