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
did you check admin override check box?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
see if admin can write to that field and print log
Did you check that field level WRITE ACL has any script which is blocking?
I also used setWorkflow(false) to exclude Query BR from running during your query
var gr = new GlideRecordSecure('incident');
gr.setWorkflow(false); // added to exclude query BR
gr.addQuery('sys_id', 'your_incident_sys_id'); // Replace with your query
gr.query();
if (gr.next()) {
if (gr.description.canWrite()) {
gr.description = 'Your HTML update';
gr.update();
gs.info('Update successful');
} else {
gs.error('No write access to description: ' + gr.getUniqueValue());
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thanks @Ankur Bawiskar
I just tried setWorkflow(false) with GlideRecordSecure and It didnt work.
Here's the log:
Running as user: system
canWrite u_description: false
u_description: null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
since canWrite() is false the update on field is not happening.
Did you use access analyzer and see which ACL is blocking?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
