Service Portal - Redirect via UI Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 01:08 PM
This is part of a UI Script that redirects a user based on roles. Line 21 isn't being called because window.localStorage isn't coming back as null (this seems to only happen if the user has a specific role).
I logged the window.localStorage in another instance that is still using CMS (and an older version of this UI Script) and it came back as null. Any ideas???
addLoadEvent(function() {
try{
if ( typeof g_user.userName != "undefined" && g_user.userName == 'guest' ) {
window.localStorage.removeItem('evgRedirectLaunched');
console.log('[RedirectHandler] Removed evgRedirectLaunched key, on login page');
}
if ( typeof g_user != "undefined") {
if ( typeof g_user.allRoles != "undefined") {
if ( g_user.allRoles.indexOf('ess_it_user') == -1 && g_user.allRoles.indexOf('admin') == -1 ) {
window.localStorage.removeItem('evgRedirectLaunched');
console.log('[RedirectHandler] Removed evgRedirectLaunched key, user is ESS user');
}
}
}
var evgDirectLaunched = window.localStorage.getItem('evgRedirectLaunched');
console.log('evglaunch: '+evgDirectLaunched);
if ( evgDirectLaunched == null ) {
console.log('[RedirectHandler] evgRedirectLaunched NOT set, processing launchredirect, g_user.userName = '+g_user.userName);
launchredirect();
}
} catch (err) {
console.log('[RedirectHandler] Error: ' + err);
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 06:00 AM
This a UI script which is client based, so that won't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 12:05 PM
I really need help with this. I've exhausted my avenues and ended up getting locked out of my instance twice. Any help or best practices are very much appreciated. If you could give examples as well, that would be awesome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 08:01 AM
Another bump -- I see tons of posts regarding this, but nothing give a full solution that will help me. Will the SPEntry script include work for us even though we have 3 portals? If so, how? I found a youtube video describing how we can add a portal reference to the company table and route based on the user's company. How can I do that by role instead? Will users without a certain role be forced to stay on the portal? Will the SPEntry script include allow for certain users to navigate to the IT view if necessary? So many questions!
We are on Helsinki Patch 11 FYI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2017 01:35 AM
Hi Blair,
Have you found a solution for this.
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 06:29 AM
Hi Rody,
We ended up reusing a global UI script we had in place and changed the CMS site to the portal site based on the user's role.