Error Reference

Cannot set value: field is read-only

Cannot set value: field is read-only

Where this appears

This error appears in ServiceNow system logs, browser console, or script execution logs when a server-side or client-side script attempts to modify a field that has been marked as read-only. It commonly occurs during Business Rule execution, Script Include operations, or when using GlideRecord operations on restricted fields.

Sourdough
Chrome Extension

Debugging this in a real instance?

Sourdough lets you trace "Cannot set value: field is read-only" through system logs, script errors, and API health in the ServiceNow tab you are already using.

Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Cause

Field has read_only attribute set to true in the dictionary definition (sys_dictionary table), preventing any programmatic updates to the field value. (high likelihood)

Access Control List (ACL) rules restrict write access to the field for the current user's role or security context during script execution. (high likelihood)

Form layout or UI policy has marked the field as read-only, and a client-side script is attempting to modify the field value through g_form methods. (medium likelihood)

Script is attempting to update a system field that is automatically managed by ServiceNow (like sys_created_on, sys_updated_on, or sys_id fields). (medium likelihood)

GlideRecord operation is being performed on a read-only database view instead of the actual table, which prevents update operations. (low likelihood)

Fix

Step 1: Navigate to System Definition > Tables & Columns and search for the specific field causing the error to examine its dictionary definition.

Step 2: Check the Read only attribute in the field's dictionary record - if checked, uncheck it unless the field should remain read-only for business reasons.

Step 3: Review Access Control Lists by going to System Security > Access Control (ACL) and search for rules affecting the table and field combination.

Step 4: Verify ACL write permissions are granted to the appropriate roles, or modify the script to run with elevated privileges using gs.getSession().setQueryScope('global') if necessary.

Step 5: If using client-side scripts, check Form Layout and UI Policies under System UI > UI Policies to ensure the field is not set to read-only in the form configuration.

Step 6: For GlideRecord operations, verify you are targeting the correct table name and not a read-only view by checking the table's sys_db_object record.

Step 7: Test the fix by running the script again and monitor System Diagnostics > Log > Application Log for any remaining read-only field errors.

Step 8: If the field must remain read-only, modify your script logic to skip updates to that field or use alternative approaches like workflows or scheduled jobs with appropriate permissions.

Test Your Knowledge

Quick 3-question quiz. See how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue