- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 08:43 AM
Id like to redirect any users without a specific role to a new portal. Ive set the default portal to the new portal. Ive tried modifying SPEntryPage.getFirstPageURL() to do a check for a specific role based on but it doesn't seem to run after a user has already logged in/started a session.
I referenced the following article:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0746730
So if a user is logged in already (and theyre in the new portal) but goes back to the old portal via a saved URL, they can do so. How can I prevent this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 02:36 PM
Hi @Ace009,
If you need to redirect the users to the new portal, you can write a UI Script,
e.g.
(function() {
var loc = window.location;
if (loc.pathname == '/esc') { //replace with your portal suffix
alert('Redirecting to the new portal');
var newUrl = loc.protocol + "//" + loc.host + "/yourportalsuffix" + loc.search + loc.hash;
window.location.replace(newUrl);
}
})();
And then add them as a JS Include in the Theme record of your old portal.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 02:36 PM
Hi @Ace009,
If you need to redirect the users to the new portal, you can write a UI Script,
e.g.
(function() {
var loc = window.location;
if (loc.pathname == '/esc') { //replace with your portal suffix
alert('Redirecting to the new portal');
var newUrl = loc.protocol + "//" + loc.host + "/yourportalsuffix" + loc.search + loc.hash;
window.location.replace(newUrl);
}
})();
And then add them as a JS Include in the Theme record of your old portal.
Cheers