Redirect users to Workspace directly

Kaustubh k
Tera Expert

Hi All,

How can we redirect certain users on the basis of roles directly to a custom workspace as soon as they log in.

 

Thanks in Advance

3 REPLIES 3

Dr Atul G- LNG
Tera Patron

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1167916

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@Kaustubh k 

you can handle this using Homepage Destination Rule

Homepage Redirect Rules in Next Experience 

💡 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

ChiragA11796440
Tera Contributor

 

You can redirect users to a specific Workspace based on their role at login using the glide.entry.page.script system property.

Step 1: Create a Script Include

Navigate to:

System Definition → Script Includes

Create a new Script Include:

  • Name: RoleBasedWorkspaceRedirect

  • Accessible from: All application scopes

  • Client callable: Unchecked

Add the following script:

 

 
var RoleBasedWorkspaceRedirect = Class.create();
RoleBasedWorkspaceRedirect.prototype = {

getRedirectURL: function() {

var user = gs.getUser();

if (user.hasRole('admin')) {
return '/now/workspace/admin';
}

if (user.hasRole('itil')) {
return '/now/workspace/agent';
}

if (user.hasRole('sn_hr_core.basic')) {
return '/now/workspace/hr';
}

return '/now/nav/ui/home'; // Default fallback
},

type: 'RoleBasedWorkspaceRedirect'
};
 

Step 2: Set the System Property

Navigate to: System Properties → Security

Open property: glide.entry.page.script

 

Set its value to: new RoleBasedWorkspaceRedirect().getRedirectURL();

Save the property.


If this solution resolved your issue, please consider marking it as Helpful or Correct so others can benefit from it as well.