Redirecting from HR Workspace to HR Agent Workspace

Swathi Sree
Tera Contributor

Hi,

 

We have a requirement to redirect the user to HR Agent Workspace from HR Workspace

 

We have configured a UI Script with the below code but its not working.

 

(function() {

     if (window.location.pathname.includes('now/workspace/hr/home')) {

     window.location.replace('/now/hr/agent/home');
    } else {
      return;
    }
   
})();
 
Any help on this topic is much appreciated.
 
Thanks in advance.

 

 

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Swathi Sree 

try this UI script

How to Disable Agent Workspace After Migrating to Service Operations Workspace (SOW) 

addLoadEvent(function() {

    if (document.URL.indexOf('workspace/hr') != -1) {
        window.location = '/now/hr/agent/home';
    } else {
        return;
    }

});

AnkurBawiskar_0-1771411320563.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

Not working

@Swathi Sree 

share your UI script config screenshot.

it should work fine, if you gave correct URL for old workspace

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Mega Sage

Hi Swathi Sree

 

Under your script , add this one

 if (window.location.href.includes('your_old_hr_workspace_url')) {
      top.window.location = "/now/hr/agent/home"; // The URL of the new HR Agent Workspace   }

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: