- 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
04-22-2014 08:41 AM
Hmmm - I'm not sure we want to route support teams to an incident via the CMS view. If I understand this correctly, this script would direct the user to the CMS page no matter what.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2014 09:14 AM
Well, it would be a matter of building up the rule sets in the script. At this point, the script checks roles, the document accessed and the referrer. So the question is, how should clicking an email link differ from the existing rules.
User Roles | Document Accessed | Referrer | Action |
---|---|---|---|
Admin | Any | Any | No Redirection |
No Roles | ITIL | Any | Redirect to CMS Homepage |
Has Any Role | ITIL | Any Non-CMS | Redirect to CMS Homepage |
ELSE | ELSE | ELSE | No Redirection |
Your rules may be slightly different, but those are from the script that was the accepted answer. So if an ITIL user clicks a link in an email that goes to the ITIL site, what should happen? If a non ITIL user clicks a link in an email that goes to the ITIL site, what should happen?
From there, we can determine the best solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2014 10:16 AM
The rules you have outlined are correct (basically - instead of 'no role' it would be != ESS_IT_User role and Has any role would be == ESS_IT_user)
If an ITIL user clicks a link in an email, they should be directed to the ITIL site. If a non-ITIL user clicks a link in an email, they should go to the CMS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2014 10:48 AM
Ok, so lets tackle these two new scenarios:
1. ITIL user clicks an email link, user should see the ITIL site
2. Non-ITIL user clicks an email link, user should see the CMS site
Scenario 1 does not require any redirect, you want to display exactly the link that they clicked. Right now though, because it is an ITIL user, accessing an ITIL site document, and its referrer is not the CMS, the third rule in the table in my previous comment is triggered, redirecting the user.
To complete Scenario 1, we need to change that rule to push it to the Else rule. You could add to the if statement for that rule by saying if ((document.referrer.indexOf('ess') != -1 || document.referrer.indexOf('navpage.do') != -1)). Email links seem to use instancename.service-now.com/navpage.do as the referrer (test for cross browser support). This has a side effect that if an ITIL user navigates directly to a specific incident by url, the ITIL user will see the ITIL site and not the CMS.
To complete Scenario 2, you would have to use the URL splicing I mentioned in an earlier post. Otherwise the user would simply redirect to the CMS homepage and not the CMS version of the Incident for instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2014 11:54 AM
I have a meeting tomorrow morning with the people who requested this enhancement. I need to verify that this is the behavior they want to achieve before I start down this road. I will keep you posted and thank you so much for your help!