Redirect to custom url when user used service-now.com URL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 06:54 AM
Hi,
We have a custom url active eg. https://acme.mydomain.com which redirects customers to the csm portal. So, when users go to https://acme.mydomain.com they end up with https://acme.mydomain.com/csm.
The old service-now.com url also stills works, and when used results in https://acme.service-now.com/csm. However, we want to redirect customers to https://acme.mydomain.com/csm when using https://acme.service-now.com. How and where to accomplish that?
Regards
Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:13 AM
Did you make the custom URL the instance URL?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:17 AM
Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:17 AM - edited 03-11-2024 07:19 AM
Hi @Jan Post2 ,
The following script work for native UI. 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/';
}
});
For portal:
If you want to do it same configuration on portal you should go to spentrypage script include.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0746730
Please test it by impersonating different users.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda