- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2019 07:01 PM
Hi There,
I created a new view "GS" in incident table. I need to create a UI action to switch to default view.
i tried with all these and none of them working. it just redirecting to incident list view. How can i switch the view from GS to default and display same incident record?
function SwitchToDefault() {
var id = current.sys_id;
g_form.checkMandatory = false;
//action.setRedirectURL('incident.do?sys_id=" + id + "&sysparm_view=default');
// action.setRedirectURL('incident.do?sys_id=' +id + '&sysparm_view=default');
//action.setRedirectURL("nav_to.do?uri=incident.do?sys_id=" + current.sys_id.toString());
//action.setRedirectURL('https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=e5ad731bdb83b380cd8190b3db9619ee');
action.setRedirectURL('https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=e5ad731bdb83b380cd8190b3db9619ee');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 08:39 PM
Hi Omkar,
I can't switch back to default view while in GS view because of view rule not allowing this. Therefore, i hide and unhide the field using script instead creating new view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2019 07:06 PM
You can use a UI action with below script. Uncheck the client checkbox in UI action if you have it checked.
action.setRedirectURL("incident.do?sys_id=" + current.sys_id + "&sysparm_view=default&sysparm_view_forced=true");
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2019 09:03 PM
Hi Sanjiv,
Thanks for quick reply, i tried this and it is not working , redirecting to incident list view as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2019 09:27 PM
Can you post your recent code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 08:39 PM
Hi Omkar,
I can't switch back to default view while in GS view because of view rule not allowing this. Therefore, i hide and unhide the field using script instead creating new view.