Issue in UI Script

prithviaram
Tera Contributor

For the URL https://www.service-now.com/esc?id=index, the redirection is not working. Please refer to the updated script below:

 

 

(function() {
    url = window.location.href;

    if (url.includes("sp?id=index")) {
        // Redirect SP index to ESC home
        window.location.assign(url.replace("sp?id=index", "esc"));
    } else if (url.includes("esc?id=index")) {
        // Redirect ESC index to ESC home
        window.location.assign(url.replace("esc?id=index", "esc"));
    } else if (url.includes("sp?id=kb_view2")) {
        // Redirect to ESC knowledge home
        window.location.assign(url.replace("/sp?id=kb_view2", "/esc?id=esc_knowledge_home"));
    } else if (url.includes("sp?id=landing")) {
        // Redirect to ESC login page
        window.location.assign(url.replace("/sp?id=landing", "/esc?id=login"));
    } else if (url.includes("/kb?id=kb_article_view")) {
        // Redirect KB articles to ESC
        window.location.assign(url.replace("/kb", "/esc"));
    } else {
        // General redirection from SP to ESC
        window.location.assign(url.replace("/sp", "/esc"));
    }
})();

 

 

1 REPLY 1

Brian Lancaster
Tera Sage

Are you trying to move from Service Portal to employee center? If so during a training I took it suggested changing the URL suffix. By going to Service Portal > Portals and then change the URL suffix for Service Portal to sp_old and then update employee center from esc to sp. This way it will be seamless to employees (no need to create new favorites) and if you have links setup in SharePoint sites you don't have to update them. You will also have to setup employee center as the default portal and remove that from service portal.