What This Table Is
The sp_page table stores Service Portal page definitions that control how end users navigate and interact with portal interfaces. Each record represents a single page with its URL route, layout structure, and widget assignments. This table serves as the foundation for all Service Portal experiences — from employee self-service portals to customer-facing knowledge bases.
Owned by the Service Portal module, this table supports the complete portal development lifecycle from page creation through widget assignment and responsive layout design. Pages can be assigned to specific portals via the sp_portal table relationship, allowing different portal experiences to share common pages or maintain completely separate page hierarchies.
This table does not extend any parent table — it's a standalone table specific to Service Portal functionality. No other tables extend sp_page, but it has tight integration with sp_widget and sp_instance records that define the actual content and behavior within each page layout.
Large enterprises typically maintain 50-200 active portal pages across multiple portal instances. Record volume stays relatively low, but the layout field can store complex JSON structures that impact rendering performance when pages contain dozens of widgets or deeply nested container layouts.
When You'll Script Against This Table
You'll script against sp_page primarily in Script Includes called by Service Portal widgets, Business Rules triggered by page modifications, and Scheduled Scripts that perform bulk page operations. Widget server scripts frequently query this table to determine current page context or redirect users to different pages programmatically. Portal-specific Script Includes use it to build dynamic navigation menus and implement custom routing logic.
Access requires sp_admin role for write operations, though widgets running in portal scope can read page data through the SPM API. Portal users cannot directly query this table — access is mediated through portal framework APIs that respect page-level access controls and portal assignments.
Common scripting patterns:
- Dynamically building navigation menus by querying active pages assigned to current portal
- Programmatic page redirects based on user role or department assignments
- Cloning page layouts for multi-language or multi-brand portal deployments
- Bulk widget replacement across multiple pages during upgrade migrations
- Custom access controls that hide/show pages based on user attributes or entitlements
- Performance monitoring by analyzing page layout complexity and widget counts
- Automated testing scripts that validate page rendering and widget functionality
Table Gotchas
The layout field stores JSON that defines the entire page structure. Modifying this field directly without understanding the schema will break page rendering completely. Always use the Portal Designer or carefully validate JSON structure before updates.
URL routing is case-sensitive and doesn't automatically handle trailing slashes. A page with id 'my-page' won't match requests for 'My-Page' or 'my-page/' unless explicitly configured.
- The
publicfield doesn't override portal-level authentication — a public page in a private portal still requires login - Page roles (
rolesfield) are cumulative with portal roles — users need access to both the portal AND the page
Deactivating a page doesn't remove it from search results or cached navigation menus immediately. Portal cache may serve stale navigation for up to 30 minutes.
- Queries on
titlefield are expensive since it's not indexed — useidfield for lookups instead - The
layoutfield has a practical size limit around 1MB — pages with 50+ widgets may hit this ceiling
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
The sp_portal table defines portal instances that contain multiple pages — each page can be assigned to one or more portals through the many-to-many sp_page_portal relationship table. The sp_widget table contains the reusable components that get embedded in page layouts, while sp_instance stores the specific widget configurations and parameters for each placement within a page.
Navigation and menu functionality connects through sp_menu records that reference pages via the page field. Developers frequently join these tables when building dynamic navigation widgets or implementing breadcrumb functionality. The sys_ui_message table provides internationalization support for page titles and content, though this relationship is managed through message keys rather than direct foreign key references.