Add a page to the navigation
Add pages to the navigation to make them accessible from other pages, such as a home page.
About this task
The following procedure describes how to complete this task manually. You can also complete the task using agentic development tools, such as Claude Code.
Before you begin
Role required: none
The ServiceNow® AI Experience Lab for VS Code extension requires the following:
| Application | Version | Resources for more information |
|---|---|---|
| Visual Studio Code | 1.97 later | Visual Studio Code updates |
| Node.js | 24 or later | Node.js |
| pnpm | 10 or later | pnpm |
| ServiceNow SDK | 4.10 or later | ServiceNow SDK |
| ServiceNow instance |
|
Prepare your upgrade |
Procedure
-
Select the ServiceNow
icon in the side panel to open the ServiceNow® AI Experience Lab for VS Code extension.
- Open a net new or extension experience.
- Optional:
If your project doesn't already have an application.js file, at the experience folder root (not under
src/extensions/), add an application.js file.Tip:Use the nav helper API from@servicenow/aiux/aiux-components-navrather than adjusting thenavLayoutContextby hand. -
Double-click (or use the keyboard shortcut) to open the
application.jsfile in explorer. -
Add the following lines of code to the application.js file with the page name and target path that you want to add.
Note:To add pages to L2, include an
l2Nav: [{icon, title, action}]array on the L1 page you pass toaddNavItem. The page accepts {icon, title, action, l2Nav?, l3Nav?}.Action Code to add in application.js Add pages to L1 sidebar addNavItem(item, {source?})Set (replace) the L3 tab array on any L1 or L2 page by path setL3Nav(targetPath, l3Nav)Append tabs to an L1 or L2 page, keeping any tabs already present appendL3Nav(targetPath, l3Nav) - Save the file.
- In the Script Runner panel, select Build.
-
Verify that the added page appears at the expected navigation level using the Quick Preview panel or by deploying to your instance.
For more information, see the following resources: