- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 10:47 AM
We already have login rules in place to redirect non-roled users to our CMS. However, we would like to route all users to the CMS -- how? Also, for itil roled users, we would like to have them click on a link from within the CMS and be routed back to the itil view.
For non-roled users, we have a homepage defined for them with a content block that redirects them to the CMS site. We don't want to do that for itil people because we don't want them to be rerouted back to CMS if this click on the link to go to the itil site. Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2014 07:07 AM
Excellent point, yes, if the ITIL user changes their home page, they would bypass your script. A better alternative is to create it as a global UI Script. Try this one out:
UI Script
Name: ESS Redirect
Active: True
Description: Redirects users to the ESS site
Global: True
addLoadEvent(function() {
if (g_user.hasRole('admin') {
// Do nothing if user is admin, this is to allow testing of the script without risk
}
// If user has no roles and they are on a non ESS page
else if (!g_user.hasRoles() && document.URL.indexOf('ess') == -1) {
// Redirect to ESS
window.location = 'https://instancename.service-now.com/ess';
}
// If user has roles, they are on a non ESS page and they were not referred from the ess site
else if (g_user.hasRoles() && document.URL.indexOf('ess') == -1 && top.document.referrer.indexOf('ess') == -1) {
// Redirect to ESS
window.location = 'https://instancename.service-now.com/ess';
}
});
NOTE: Global UI scripts will run on both ITIL site and ESS site. This is why the document.URL.indexOf('ess') is necessary, it prevents redirection from the ESS site to the Ess site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 10:29 AM
Thanks Travis - I look forward to your Holy Grail redirect! I'm totally not a scripter. If I wanted to edit the FirstPageURL to point to the sp but allow them to click a link for navpage, where do I adjust it? Our portal is /sp and homepage is index. Thanks!
getFirstPageURL: function() {
var session = gs.getSession();
this.logProperties('before', session);
var check = session.getRoles();
// has roles and is not a Service Portal page - go to UI16
var nt = session.getProperty("nav_to");
var isServicePortalURL = new GlideSPScriptable().isServicePortalURL(nt);
var redirectURL = session.getProperty("login_redirect");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2016 04:38 AM
We have this working for internal users but were also trying to do this for our external customers.
scenario
We are in the process of rolling out customer service management and part of this is we have multiple customer portals. If a customer (role snc_external) goes directly to a page say instancename.service-now.com/portal1 or instancename.service-now.com/portal2 i want them to be able to go there. However if they take the url suffix off the end, I want to be able to redirect them to a specific landing page that we determine.
The issue is, that is a customer removes the url suffix, and goes to instancename.service-now.com they get the security constraints page. so we can run a global UI action on that Thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 01:33 PM
Hello all -- this a great feed. Has anyone seen anything like this when the SN session times out. We seem to have the page trying to redirect to the clicked page -- what I'd like is for the user to be directed back to ess after they re-authenticate with Okta. We're using Okta with SAML. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2018 10:06 AM
Nice article.
One thing, that UI Script runs after UI16 form was loaded.
So, we have a breach here, that user can stop loading page after UI16 form was partially loaded and UI Script won't run.