- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 02:23 AM
Hi Team,
I need script for OnCellEdit client script for below requirement as i dont want to Write ACL for it due to some issues.
Prevent editing the following fields via List Editor (cell edit) only when the Type is Standard:
description
implementation_plan
test_plan (aka "Test and Validation Plans")
backout_plan
Can Someone please help me thanks in Advanced
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 07:19 AM
I already shared another option i.e. use before update business rule
But remember this will impact and stop user from saving when fields get updated from form as well.
Any reason not to use list_edit ACL?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 05:16 PM
bro you have to use the client script and scrip include .
refer this code .if your code not working please let me know i will help you to write the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 05:54 AM
something like this you can check and then enhance for your table, field and values
Example: Don't allow user to select the below state values on incident
Note: Use proper choice values
Example:
6 - Resolved
7 - Closed
9 - On Hold
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if(newValue == '6' || newValue == '7' || newValue == '9'){
alert('Not allowed');
saveAndClose = false;
} else {
saveAndClose = true;
}
callback(saveAndClose);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 06:23 AM
Hi @Ankur Bawiskar
Thank you for Reply,
I need for Change record, Not on incident could you please help me
Prevent editing the following fields via List Editor (cell edit) only when the Type is Standard:
description
implementation_plan
test_plan (aka "Test and Validation Plans")
backout_plan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 06:41 AM
I just shared an example and you can enhance it further based on your requirement and development skills.
Just remember one thing, if you are saying based on some other field value you want to stop editing using onCell edit then it's not possible.
You cannot access other field value in onCell edit client script.
In this case you can use before update business rule and stop the update.
Best is to use list_edit ACL and check the Type value on each of those list edit ACLs for field.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 07:09 AM
Hi @Ankur Bawiskar
I cannot new list_edit ACL as it is affecting existing ACL. Could you please suggest me alternate Solution.
Thank you