- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2021 07:47 PM
I'm using this OnCellEdit client script to restrict changing the state to "close" of a Catalog Task from RITM view and it's working. Whenever one attempts to change the state of any catalog task, from the RITM view, an alert is generated, "Not allowed". The issue is that it works for all catalog tasks. I want it to work for only a particular catalog task in the workflow. We'll call that catalog task "NetworkOp Task".
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2021 10:41 PM
Hi Dom,
Unsure about the need for onCellEdit but suggestion would be to go with an before update business rule on Catalog task table where you can check for Item & then abort the action by displaying error message instead of alert.
This would not inovlve any coding as well. Something as below.
1. Business rule Replace your catalog item accordingly. Not item field is dot-walked from Request item table.
Since, its business rule it would work regardless of state being changed from List or Form or anyother view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2021 06:13 AM
Thank you the suggestion.
I need to abort the cell edit not just for a specific catalog item. I need to abort it for a specific "catalog task" in a specific "catalog item".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2021 11:16 PM
You cannot access the field value using g_form object in onCell Edit so as suggested by Jaspal you should use before update business rule
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2021 10:41 AM
It is better to use ACL for restriction

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2021 10:57 AM
That can work but most server side code will by pass the ACL's so it will depend on what needs to be prevented and when.