- 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 02:34 AM
Hi @vivek11
You need to use a client-callable Script Include to check the change type and return the appropriate response back to the client script..
In your onCellEdit client script, use GlideAjax and pass the sys_id of the record to the Script Include.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 05:02 AM
Hi @J Siva
Thank you for Quick reply,
If possible, Could you please provide me code.. It is not working for me?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 02:48 AM
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
// Fields you want to block in list editor
var blockedFields = ['description', 'implementation_plan', 'test_plan', 'backout_plan'];
// Check if the edited field is in blocked list
if (blockedFields.indexOf(newValue.changedField) > -1) {
// Check the Type value; it might be in oldValues or newValue depending on your list
var typeValue = oldValues.type || newValue.type;
if (typeValue == 'Standard') {
alert('Editing this field is not allowed when Type is Standard.');
saveAndClose = false; // Block the change
}
}
callback(saveAndClose);
}
Checks if the field you’re trying to edit is one of the blocked fields.
Checks if the record’s Type is Standard.
If both match, shows an alert and cancels the edit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 05:04 AM
Hi @Community Alums
I have tried it but not able to find anything, It is not working for me...
Could you please help me