Incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2025 09:52 PM
When the user select Incident state is "On hold" then remaining all fields should be Read only.
Any idea how to build this above example task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2025 09:55 PM
Hi @P1234 ,
✅ Approach: Use a Client Script (Type: onChange)
1. Script Details
Type: onChange
Table: Incident
Field name: state
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == oldValue) {
return;
}
var onHold = (newValue == '3'); // Replace '3' with your actual "On Hold" state value (check sys_choice)
var fieldsToDisable = [
'short_description',
'description',
'category',
'subcategory',
'impact',
'urgency',
'assignment_group',
'assigned_to',
'priority',
'contact_type',
'location',
// Add any other fields you use
];
for (var i = 0; i < fieldsToDisable.length; i++) {
g_form.setReadOnly(fieldsToDisable[i], onHold);
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Arun Manoj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2025 10:16 PM
Hi Arun,
Code is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2025 10:21 PM
Hi Arun,
When the user select state is "On hold" & on hold reason is "Awaiting Caller" then remaining fields should be read only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2025 10:17 PM
Hi @P1234
You can do it with help of UI policy, which is low code/no code.
UI policy:
Condition: state = on hold
UI Policy Action:
Read only --> add field one by one.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************