- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 01:40 PM
Version: Madrid
Scoped Application
Hi all,
I am facing an issue to redirect the URL back to the form from the UI page. I have a UI page that displays pop up with some fields. After the user successfully submits the pop up with the information user clicks Ok. On the 'OK' button click, it should redirect back to the screen that brought up the pop-up instead it is redirecting to the new UI page form. Below is the code I used:
<g:dialog_buttons_ok_cancel ok = "return true" cancel = "return continueCancel()"/>
To redirect back used the below standard code in the UI processing script:
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
Any help what might be the issue?
Thanks in advance,
Pavan.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 02:06 PM
Hi,
What I do is add this hidden input type to the HTML section:
<input type="hidden" id="system_id" name="system_id" value="${sysparm_record_id}"/>
Then, in your processing script you can do something like (EXAMPLE):
var url = 'incident.do?sys_id=' + system_id;
response.sendRedirect(url);
Just replace incident with the name of your table and it will redirect back to the original record.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 02:06 PM
Hi,
What I do is add this hidden input type to the HTML section:
<input type="hidden" id="system_id" name="system_id" value="${sysparm_record_id}"/>
Then, in your processing script you can do something like (EXAMPLE):
var url = 'incident.do?sys_id=' + system_id;
response.sendRedirect(url);
Just replace incident with the name of your table and it will redirect back to the original record.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 02:35 PM
Thanks for the response, Allen.
It worked partially. But I am getting sys_id as empty so it is redirecting to the new record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 02:40 PM
Hi,
In your original post you said you are calling this UI Page to have the user fill in some fields then wanting to go back to the same page.
If you're just doing that, then how is it creating a new page..and what is a "new UI page form"?
Otherwise, my method does work. Please check your code.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 02:43 PM
New UI page form means, On 'OK' button click, earlier it was taking back to the UI page that has few fields. But, adding your code at-least it is redirecting back to the list view instead. As I am getting the empty sys_id unable to redirect back to the new record.