Can List Edit be restricted using client script?

shalinichiluka
Kilo Contributor

Hello All,

Apart from restricting the list edit using below methods:

Personalize list , Context menu - List Edit, ACL

  1. Can List Edit be restricted using client script?
    If yes, using which function? OnCell Edit?
    Can you show a piece of code that makes it possible.
  2. Also can we use Business Rules to restrict the list edit?
4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shalini,



List Edit client script won't restrict from saving.


Also business rule you can check it should restrict when you have before update business rule.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

While the BR option could work with a before/update and abort - you're technically not disabling the list edit. You're reprimanding someone for doing something after they've done it. That kind of experience makes users say bad things.


Chuck Tomasi
Tera Patron

Short answer.


1. No.


2. No.



1. ACLs are your best way to restrict list editing (without allowing the user to override.) The onCellEdit client script is what gets involved when you do the list edit, so by that time it's too late. Using that would be like telling your kids to lock the door (from the inside) after they've already left the building.



2. Business rules run on database actions. Delete, create, update, read. While a list operation is technically a read, there's no option available to say change the behavior to enable/disable list editing based on a database read


Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do something in oncelledit where you return false, but they would still be able to double click and type something it just wouldn't save. This would be a frustrating user experience so I would stick to the methods you listed above. I don't think there's much you can do from a business rule.



Why don't you want to use an ACL for this?