- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 07:31 AM
Hello Everyone,
We have a requirement to optimize a page in Service Portal. Currently, all widgets are performing the same queries but each of the widget are performing gliderecord in the Server Script. We want to have the gliderecord in only 1 widget (Widget 1) and call or use the data from Widget 1 to use it on other Widgets (Widget 1, Widget 2, etc.).
Regards,
Diane
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 06:41 AM - edited 09-19-2023 06:46 AM
Hi @dianemiro,
Good point, I was investigating and found a different option:
This way in your first widget you can make the queries on the Server Side and use Local Storage as it gets saved on the user session and on the other widgets you can just use session.getClientData(object, param2), and all your data saved will be accessible. It solved a lot of performance issues in a particular use case that I had.
As per your question, broadcast does expect something to trigger an event so it can replicate data to another widget that is listening - but it can be tricky and you can maybe try this:
Angular run function on broadcast and page load

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 11:04 AM - edited 09-18-2023 11:05 AM
Hi @dianemiro,
You can use these two angular methods:
$broadcast Method. A method of $rootScope that dispatches an event to all its child $scope.
$on Method. A method of $rootScope that listens to propagated events. It has two parameters: the name of the event to listen, to and the function to be executed.
A quick video to help: https://youtu.be/uEK0SWiiZ3E
Tip: Sometimes the call on the client side using Table API from ServiceNow was performing better for a use case that I had, so if you want to test it too it might be faster than calling in the server, pulling from the client, and only then showing at the browser.
If you found my answer helpful or correct in any way, please don't forget to mark it to help future readers! 👍
--
Kind regards,
Marcos Kassak
Solution Consultant 🎯
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 03:38 AM
Hello @Marcos Kassak,
Thanks for your help! I watched the quick video and it involves having a button clicked to initiate the listeners. Does these methods also support without the need to click a button? Thank you!
Regards,
Diane Miro

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 06:41 AM - edited 09-19-2023 06:46 AM
Hi @dianemiro,
Good point, I was investigating and found a different option:
This way in your first widget you can make the queries on the Server Side and use Local Storage as it gets saved on the user session and on the other widgets you can just use session.getClientData(object, param2), and all your data saved will be accessible. It solved a lot of performance issues in a particular use case that I had.
As per your question, broadcast does expect something to trigger an event so it can replicate data to another widget that is listening - but it can be tricky and you can maybe try this:
Angular run function on broadcast and page load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 08:11 AM
Thank you, @Marcos Kassak, I think the local storage will be more applicable for our use case.
Regards,
Diane