Skip to content

Instantly share code, notes, and snippets.

@mtcoffee
Created February 8, 2026 16:28
Show Gist options
  • Select an option

  • Save mtcoffee/7f7bf1d7da59f6d72e7b51575f4129c9 to your computer and use it in GitHub Desktop.

Select an option

Save mtcoffee/7f7bf1d7da59f6d72e7b51575f4129c9 to your computer and use it in GitHub Desktop.
ServiceNow sys_navigator redirect Incident Platform UI to the SOW Workspace if view not set
(function(g_uri) {
var view = g_uri.get("sysparm_view");
// Check if the user is ITIL, not Admin, and the view is null/empty
if (gs.hasRole("itil") && !gs.hasRole("admin") && gs.nil(view)) {
// Construct the Service Operations Workspace path
var table = current.getRecordClassName();
var sysId = current.getUniqueValue() || "-1";
// In sys_navigator, returning a string starting with / overrides the URI
return "/now/sow/record/" + table + "/" + sysId;
}
// Otherwise, return the original URI (default behavior)
return g_uri.toString();
})(g_uri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment