- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 05:42 PM
Is it possible to satisfy the following three conditions at the same time when transitioning from the portal to a URL outside of ServiceNow?
We would like to realize the following functions when transitioning to a URL outside of ServiceNow from a quick link or menu.
(1) Click on the link
(2) Obtain the destination URL and user data from the user (customer_contact) data in the client script(assuming the destination URL and other data are registered in a specific table)
(3) Create the page to jump to using the data from (2) above.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 10:15 PM
Hi,
Here are the steps to redirect URL outside of Servicenow
1. Navigate to Service Portal - > Widgets and create a new widget. eg. Redirect Menu
Server Script
(function() {
// Get the key from the URL parameter
var key = $sp.getParameter('key');
// Fetch the system property (JSON string)
var urlsJson = gs.getProperty('portal.menu.url');
var obj = JSON.parse(urlsJson);
var result = obj[key];
data.targetUrl = result;
})();
Client Script
api.controller=function($scope, $window) {
/* widget controller */
var c = this;
// Redirect to the URL fetched from the system property
$window.location.href = $scope.data.targetUrl;
};
2. Create a system property to store menu URLs
Name - portal.menu.url
Value - {"menu_A" : "https://www.servicenow.com/","menu_B" : "https://www.google.com/"}
3. Navigate to Service Portal - > Pages and create a new page. E.g. redirect_menu_url
4. Add the widget created in step 1 to the new page
5. Go to the Service Portal Menu Item and pass the key and page id in HREF/URL
Note : You can add the logic to the widget to fetch the logged in user data and obtain the destination URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 10:15 PM
Hi,
Here are the steps to redirect URL outside of Servicenow
1. Navigate to Service Portal - > Widgets and create a new widget. eg. Redirect Menu
Server Script
(function() {
// Get the key from the URL parameter
var key = $sp.getParameter('key');
// Fetch the system property (JSON string)
var urlsJson = gs.getProperty('portal.menu.url');
var obj = JSON.parse(urlsJson);
var result = obj[key];
data.targetUrl = result;
})();
Client Script
api.controller=function($scope, $window) {
/* widget controller */
var c = this;
// Redirect to the URL fetched from the system property
$window.location.href = $scope.data.targetUrl;
};
2. Create a system property to store menu URLs
Name - portal.menu.url
Value - {"menu_A" : "https://www.servicenow.com/","menu_B" : "https://www.google.com/"}
3. Navigate to Service Portal - > Pages and create a new page. E.g. redirect_menu_url
4. Add the widget created in step 1 to the new page
5. Go to the Service Portal Menu Item and pass the key and page id in HREF/URL
Note : You can add the logic to the widget to fetch the logged in user data and obtain the destination URL