how to switch view from ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 03:42 AM
Hi All,
How we can directly switch to a particular view from a ui action? Tried few scripts but not working as expected.
Regards,
Jobin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 03:45 AM
but why?
where you require this? native or workspace?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 03:55 AM
UI action for view change, not a good way mate. Use OOTB way only and avoid technical debt.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 03:58 AM
Hi @jobin1
Check these posts.
https://www.servicenow.com/community/developer-forum/switch-the-view-using-ui-action/m-p/1986285
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 04:36 AM
Hello @jobin1 ,
Try this script and it only works for form button
var view_name = "default";
var tableName=current.getTableName();
var url = tableName + ".do?sys_id=" + current.sys_id + "&sysparm_userpref."+tableName+".view=" + view_name;
action.setRedirectURL(url);