The Now Platform® Washington DC release is live. Watch now!
‎04-19-2016 03:06 AM
Hello Everyone,
We have couple of sites in our instance & its SAML 2.0 configured.Which is the best method to redirect the user depending on the employee type?
Thanks,
Abhinandan
Solved! Go to Solution.
‎04-19-2016 04:53 AM
Create an UI Script with the following:
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 && document.URL.indexOf('login_locate_sso') == -1) {
// Redirect to ServiceDesk
window.location = 'https://your-instance.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 ServiceDesk
window.location = 'https://your-instance.com/ess/';
}
});
This should help you out...
Something I use for redirection.
‎04-19-2016 03:35 AM
Hi,
I think, Login rules can be a solution to your requirement.
Legacy:Configuring the Login - ServiceNow Wiki
Raj
‎04-19-2016 03:59 AM
Hi Rajmasurkar,
Thanks for the response. Login rules can't be the solution here.Because our instance is SAML 2.0 configured. And Login Rules are not supported with SAML 2.0.
You can refer the link which you have provided.
Thanks,
Abhinandan
‎04-19-2016 04:53 AM
Create an UI Script with the following:
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 && document.URL.indexOf('login_locate_sso') == -1) {
// Redirect to ServiceDesk
window.location = 'https://your-instance.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 ServiceDesk
window.location = 'https://your-instance.com/ess/';
}
});
This should help you out...
Something I use for redirection.
‎04-19-2016 11:50 PM
Did it work?