Set Default View Using View Rule

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2019 05:36 AM
Hello Team,
I have a requirement to set a business service form to default for users with a role. I have to set it using View rule by using the advanced script. The problem I have encountered is unlike all the views ,Default view doesn't have a name. It is showing empty. How can we set the view in the script for default view? Will this be possible by using formats like view="" or view=null or even view=undefined?
This can be possible from module link view, but I am trying to find whether we can set the Default view from script in view rule
Regards,
Jagadeesh
- Labels:
-
User Experience and Design

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2019 05:53 AM
Hello,
Thank you for the reply. Is there a way to enforce the view to ITIL users without using the script in the above view rule?
Regards,
Jagadeesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2019 06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 03:09 PM
Hi @Jagadeesh R1 ,
this is working for me:
(function overrideView(view, is_list) {
if (gs.hasRole("admin")) {
return; // Omit admin users
} else {
var urlMap = gs.action.getGlideURI().getMap();
if((urlMap.get("portal_id") + "").length > 30) {
return; // Omit's poral loads
} else {
answer = ""; // Sets default view
}
}
})(view, is_list);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 05:01 AM
Hi, you can simply uncheck the advanced button in your View Rule and leave the field "View" empty. This will enforce the Default view.
As a result, the view selection will be hidden on the table:
If you need the script for something else then you can add this line to it at the end:
answer = ''; // enforce default