- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 08:10 AM
Hello Team
I have a custom table where i have different list view.
But when i try to impersonate someone who has student role, or instructor role. It always goes to default view. How do i change to if i impersonate a student of instructor, it should go to one of these view. Thanks for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 11:20 AM
Hi @huyjor ,
Create View Rules like below:
You have to be sure that for all users one view rule is applicable, and only one.
Dont use null, mention the view you send users who are not itil.
Here is an example you can refer to.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 08:12 AM
@huyjor You need to create a View Rule to make a user use a specific view. Please refer to the documentation https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/administer/navigation-a... to know more about view rules.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 08:14 AM
Hi @huyjor ,
You can create a View Rule, follow the steps : https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/administer/navigation-a...
Else, if you want to use a scripted View Rule :
(function overrideView(view, is_list) {
answer = view;
if (gs.hasRole("finance_transformation"))
answer = "Finance_Transformation";
})(view, is_list);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 10:31 AM
I have 2 view rules

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 11:05 AM
@huyjor Please update your view rules as follows.
(function overrideView(view, is_list) {
answer = view; // set the new view to answer
if(gs.hasRole("x_74571_kb_univ.sno_ku_student")){
answer = "student"; //student is name of list view
}
})(view, is_list);
------------------------------------------------------
(function overrideView(view, is_list) {
answer = null; // set the new view to answer
if(gs.hasRole("x_74571_kb_univ.sno_ku_instructor")){
answer = "instructor"; //instructor is name of list view
}
})(view, is_list);
and check it it works correctly.