- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 09:21 AM
Hi all,
We have a requirement to make all fields read only on incident except State and Worknotes.
This should happen when user from the current assignment group opens the form.
if Assigned user is the current logged in user, then need to make state and worknotes only editable on the form. Remaining fields like contact type, email, category and sub category, ci, service needs to be read only.
Please help me with the client script to acheive this.
Thank you,
Balaram.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 04:29 AM
You can use client script for this
function onLoad(){
if(g_user.userID == g_form.getValue('assigned_to')){
// make all fields readonly
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
// make state and work notes editable
g_form.setReadOnly('state', false);
g_form.setReadOnly('work_notes', false);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 09:40 AM
Hello,
This is best handled by using ACLs versus client scripts.
You'd want to review your "write" ACLs for the incident table and see what is allowing them to be able to write today and then consider changing that so not everyone can write to it freely. Then, you'll want to work on field specific ACLs to only allow them to write to them if they're a member of the assignment group and only for 'x' fields (not all).
Here's documentation on how to create ACLs: https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/contextual-security...
Please mark rely as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 07:04 PM
You will need client script and business to make fields read only based on group membership
Please follow the below steps AS EXAMPLE to get this configured:
1) Write a Display Business Rule on the Incident Table as shown below:
In the above Screen shot Replace the Group "CAB Approval" with your Group Name
2) Once the Business Rule has been configured Write an On Load Client Script On the Incident Table to make the field Mandate if the Logged in User is a part of the required Group as shown below:
In the Above screen shot Replace "description" with your required field Names.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 12:20 PM
I am trying to complete similar requirements. I need to mark 'state' and 'assignment group' as read only if the logged in user has the Mule-Hide Regional Directors group. I tried to accomplish this using the information you provided. I am wondering what I am doing wrong that would make it not work? Thank you
When to run is set as 'display'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 12:33 PM
Hi,
Can you add logging to your business rule to check that value there?
Is the group name spelled correctly as verified within the instance?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!