Explain g_navigator and it's functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 04:22 AM
I need to understand use of g_navigator global api and it's functions with example. specially the use of "g_navgator.refreshNavigator()" function.
But an explanation to all the function will be great.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 04:41 AM - edited 04-23-2024 07:21 AM
Hi @Hrishabh Kumar,
I assume you've already checked the SN Docs API site? Just in case, see below.
Essentially, it's intended use is to refresh the content in the navigator frame in response to some script action for example. It's not that common but it's actually as simple as that, and very easy to call and implement (as you've already shown in your question)
Was there anything specifically you wanted to find out or be explained?
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:52 AM
Hi @Robbie ,
I have went through the docs as well, but it d not helping as it does not have much. Can you give me code snippet where g_navigator.refreshNavigator() is used. Because I'm not able to implement this through code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:59 AM
g_navigator is a global API object that provides methods for interacting with the navigation menu and sidebar in the UI. It allows developers to customize and control navigation behavior within the ServiceNow platform. Here are some of the commonly used functions of the g_navigator object along with examples:
1. refreshNavigator(): This function refreshes the navigation menu and sidebar, ensuring that any changes made to the navigation items or permissions are reflected immediately. Ex: g_navigator.refreshNavigator();
2. collapseAll(): This function collapses all sections of the navigation menu, making it more compact and organized.
Example: g_navigator.collapseAll();
3. expandAll(): This function expands all sections of the navigation menu, displaying all available items.
Example: g_navigator.expandAll();
4. toggleSection(sectionId): This function toggles the visibility of a specific section in the navigation menu identified by its sectionId.Example: g_navigator.toggleSection('incident'); // Toggle visibility of the Incident section
5. toggleFavorites(): This function toggles the visibility of favorite items in the navigation menu.
Example: g_navigator.toggleFavorites();
6. navigateToModule(moduleId): This function navigates to a specific module identified by its moduleId.
Example: g_navigator.navigateToModule('incident'); // Navigate to the Incident module
These are some of the commonly used functions of the g_navigator global API in ServiceNow. They provide developers with the ability to customize and control navigation behavior to enhance the user experience within the platform.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks