Need help writing an OnCell Edit Script on Hardware Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 02:14 AM
Hi,
I need to write an OnCellEdit script on " Hardware Status " field on hardware table.
Old Requirement: Users which doesn't have ecmdb_admin role can't change the Hardware status to "Stolen/Lost".
For that I wrote the below OnCellEdit client script on Hardware table for field Hardware status.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 03:11 AM
why not handle the list edit via list_edit ACL for that field?
you can handle this using conditions of ACL
Did you try that?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 03:51 AM
Ho @Ankur Bawiskar I have not tried that, will try implementing. But the query is cannot it be done by onCellEdit client script with one additional condition.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 03:54 AM
I am saying it's recommended to use list_edit ACL here with minimal script
you cannot access other field value using g_form using onCellEdit so you cannot determine what's the environment.
using onCell edit you can access only the field value on which onCell Edit is written
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
09-07-2023 04:07 AM
Noted