- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 01:36 PM
Hello,
How can I redirect a user back to a particular view after a UI Action is clicked? I want them to land on the same record, but I want their views to change?
This is the UI Action I have:
function closeTicket() {
var dialogWindow = new GlideDialogWindow('incident');
dialogWindow.setTitle("Close Ticket");
dialogWindow.setPreference('sysparm_incident', g_form.getUniqueValue());
dialogWindow.setWidth(850);
dialogWindow.render();
}
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 06:45 AM
I guess you missed the quotes:
var url = 'incident.do?sys_id=' + incident + '&sysparm_view=default';
response.sendRedirect(url);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 08:55 PM
In order to switch views, you just have to add an extra parameter in your redirect URL called sysparm_view, and give the name of your view:
g_navigation.open('/incident.do?sys_id=d05bf3002f6330108d3fe36ef699b61a&sysparm_view=workspace');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 06:24 AM
I didn't realize there was a UI Page, but in the UI Page, there is a redirect happening through the processing script:
var url = 'incident.do?sys_id=' + incident; //Incident is already defined in script
response.sendRedirect(url);
I tried your suggesting and adding the 'sysparm_view=default', but it did not work
var url = 'incident.do?sys_id=' + incident + sysparm_view=default;
response.sendRedirect(url);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 06:45 AM
I guess you missed the quotes:
var url = 'incident.do?sys_id=' + incident + '&sysparm_view=default';
response.sendRedirect(url);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 08:58 PM
Hi,
can you share your entire UI action script.
It seems you are calling UI page and doing some processing there
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader