Can we have two Client scripts on the same record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 10:53 PM
I have a doubt which goes like this:
1. I have a client script onchange to run a script like when the channel is changed the category have only one set of options.
2. And at the same time I am running another onChange client script like when the category is changed the subcategory should contain only a set of options.
Is there any way to achieve this both in the default view form as well as the worksapce view form of Incident record. And If possible provide some example scripts.
Note: the client script should act at the same time when the user interacts on the incident record.
Thanks in advance,
Saideepakk.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 11:20 PM
Hi @SaiDeepakk ,
Can you provide some screenshots of your script and form. Why do you need client script for subcategory?
You can use dependent field, so based on the category subcategory choices will show.
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 11:26 PM
no worries, both scripts are running on different field and will do their respective job properly provided your script logic is correct.
you should mark Global Checkbox as True so that it runs in Desktop and Workspace view
Note: Ensure Channel, Category, Subcategory fields are there in workspace view so that your logic runs fine
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-26-2025 09:52 PM
Hope you are doing good.
Did my reply answer your question?
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-27-2025 03:31 AM
Hi @SaiDeepakk ,
Yes, you can do this in both Default view and Agent Workspace.
Use onChange Client Scripts with g_form.clearOptions + g_form.addOption (works in both).
Either:
Two scripts:
Channel → filters Category
Category → filters Subcategory
One combined script (recommended): attach to both channel and category, handle filtering in one place.
Best practice: Bundle logic into one script for predictable execution.
