- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 01:45 AM
How to pass data from one portal page to another portal page?
In the past I have passed the data from widget to another widgets... but what about pages ?? Any leads
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 01:49 AM
You can pass data in the URL when navigating from one portal page to another.
<a href="/sp?id=target_page&user_id={{user.sys_id}}">Go to Target Page</a>
Following can be used to retrive the data.
var userId = $location.search().user_id; // Retrieves the value from the URL
console.log("User ID:", userId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 01:51 AM
Hey @sanyalshubh
Keep a thumb Rule :-
To access data between two pages, we need to send data via URL as shown below.
Set URL as below on source page client controller :
function ($scope, $window) {
var c = this:
c.onClick = function () {
$window.location.href = "/sp?id=new_portal_page&incidentNumber=" + INC00001234;
}
}
On the server side of the target page, we can use below code to access those parameters:
var incNumber = $sp.getParameter('incidentNumber');
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:12 AM
Hello @sanyalshubh
You can pass data between two pages by two method:
Use URL Parameters for small amounts of simple data. This is a quick and effective method for passing data between pages when the data is small and non-sensitive. Example: passing IDs, status, or short strings in the URL query.
window.location.href = "/sp?id=target_page¶m1=value1¶m2=value2";
On the receiving page, use $location.search() to retrieve the parameters:
$scope.param1 = $location.search().param1;
$scope.param2 = $location.search().param2;​
Use Session Storage if you need to pass larger or more complex objects. Session storage allows you to store complex data (like JSON objects) temporarily within the browser session. It provides more flexibility and doesn't expose the data in the URL.
sessionStorage.setItem('complexData', JSON.stringify(yourDataObject));
On the receiving page, retrieve the data like this:
var retrievedData = JSON.parse(sessionStorage.getItem('complexData'));​
Refer: Understanding Session Storage in ServiceNow Widgets: Client and Server-Side Techniques
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar