- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 06:44 PM
I would like to write a client script that will display a popup when a category is selected.
But I don't know how to write it.
Please let me know.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:18 PM
The screenshot shows a portal page.
To show a pop here, we need to update the Categories widget on the left. (This is not simple, but let me try my best to guide you)
Navigate to sp_widget table, and open the record with name SC Categories.
You will find that the page is readonly. Now we need to clone the widget.
(Remember to recreate the Angular Provider(related list) for your new widget).
Now 2 major updates need to be done :
1. Link the new widget to the sc_category page(you need to go to the sp_page table for this)
2. In your new widget, update the $scope.categorySelected function with extra script in the Client Controller.
Your extra script should call a modal window.
Check
https://www.w3schools.com/bootstrap4/bootstrap_modal.asp
Long Live ServiceNow!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 11:51 PM
Thanks for the reply.
What script do I need to include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2021 09:28 PM
Hii miyu,
In client script write OnChange() client scritpt:
var np=g_form.getValue('category');
alert('my category is'+np);
Please mark reply as Helpful/Correct, if it is helpful for you.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:18 PM
The screenshot shows a portal page.
To show a pop here, we need to update the Categories widget on the left. (This is not simple, but let me try my best to guide you)
Navigate to sp_widget table, and open the record with name SC Categories.
You will find that the page is readonly. Now we need to clone the widget.
(Remember to recreate the Angular Provider(related list) for your new widget).
Now 2 major updates need to be done :
1. Link the new widget to the sc_category page(you need to go to the sp_page table for this)
2. In your new widget, update the $scope.categorySelected function with extra script in the Client Controller.
Your extra script should call a modal window.
Check
https://www.w3schools.com/bootstrap4/bootstrap_modal.asp
Long Live ServiceNow!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 02:43 AM
Thanks Anirudh, Can you suggest on similar type of reuqyest. https://community.servicenow.com/community?id=community_question&sys_id=f7e70a4fdb4c51182454e6be1396199c