Workspace Redirect from records in the Core UI

Workspaces in ServiceNow have revolutionised the way fulfillers work on tasks in ServiceNow. The platform provides a feature to redirect users to a workspace when they log in, however it doesn’t prevent them from using the Core UI to access records in the platform.

As we all move over to workspaces, so does the ServiceNow developers focus when it comes to feature development. It’s now common to find functionality developed in Workspace that’s not available in the Core UI. With some of this functionality core to a process, it’s important to ensure that fulfillers are using the right tool for the job.

The problem though is that ServiceNow email notifications have not yet caught up and the user still has the option to navigate to the Core UI.

The Fix

We can employ the use of a little known / used feature in ServiceNow called a Navigation Handler [sys_navigator]. If you’ve ever wondered why sometimes when you click a record in a list, you don’t see a standard form, well this is it. Take the Flow [sys_hub_flow] table for example. If you open a record from the list on this table, you’ll find yourself being redirected to the Flow Designer UI.

Below you’ll find a simple example that redirects users from the Core UI to Service Operations Workspace when opening an incident record.

(function() {
	var sysId = g_request.getParameter('sys_id');
	if (!gs.nil(sysId)) {
		return 'nav_to.do?uri=/now/sow/record/incident/' + sysId;
	}
	
	return 'nav_to.do?uri=/now/sow/record/incident/-1';
})();

Of course this may well present issues when using some ServiceNow functionality. Let’s take the Major Incident Workbench as an example. If we apply the above script to our navigation handler, anyone visiting the Major Incident Workbench would also be redirected to the the Service Operations Workspace. We can make a simple addition to our script to ensure that the only view we redirect people with is the default view.

(function() {
  var view = g_request.getParameter('sysparm_view');
  
  if(!gs.nil(view) && view != 'default') {
    return ''; // returning an emptry string results in no change to the URL.
  }
  
	var sysId = g_request.getParameter('sys_id');
	if (!gs.nil(sysId)) {
		return 'nav_to.do?uri=/now/sow/record/incident/' + sysId;
	}
	
	return 'nav_to.do?uri=/now/sow/record/incident/-1';
})();

Share this with your network

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top