Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2024 10:32 PM
Prevent user from changing the state to closed in the List edit - use the Custom table.
Write client script but code is not working .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2024 10:41 PM - edited 08-18-2024 10:46 PM
Hello @Ram012 , to prevent user updating the state on List view, you need to create a onCellEdit client script which will execute on list as below -
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
if(newValue == 7){ //please check the state value from backend.
saveAndClose = false;
}
callback(saveAndClose);
}
For more information on the onCellEdit client script, please refer below links -
https://www.basicoservicenowlearning.in/2019/12/client-script-in-servicenow.html
If my answer solves your issue, please mark it as Accepted ✔️& Helpful👍!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2024 11:31 PM
@Ram012 You should use ACL with list_edit operation to prevent users from editing a specific field from the list. Please refer to https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743628 to know more about this.