- 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
01-03-2024 04:22 AM
This comment is for people that may encounter this in the future:
Create a new UI Action for the record.
Condition: RP.getParameterValue('sysparm_view') == 'View_Name'
Script:
I put a Check mark in "Form button" so when in a specific view, a button shows in the top, if you click this button, you are taken back to the default view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2019 09:25 PM
Hi,
Check below link, it may help you,
https://community.servicenow.com/community?id=community_question&sys_id=ab301fe5dbdcdbc01dcaf3231f9619df&view_source=searchResult
Mark correct/helpful based on impact.
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2019 07:38 AM
Have you verified that there are no view rules that are competing with what you are doing? View Rules can be set to override what is supplied via URL.