- 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:57 PM
Hi,
Please try again and ensure there isn't any other conflicting code here.
Make sure you add the hidden line to the HTML section of your UI Page and then in the processing script, you use only those 2 lines I gave for supplying the URL and the redirect. Don't use any prior code you had.
This will take the record id, which was pulled from the URL for the record, which still exists even when calling a UI Page, and then using that to pass it back over to the redirect to send the user back to the page when they are done.
I'm not sure what you mean by it's redirecting them to "the new 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
02-15-2024 04:43 PM
This did the trick for me! Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:53 PM
You are very welcome and thank you for leaving a comment letting us all know it helped! 😁
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:12 PM
do you have multiple browser sessions open? Can you try this with just one browser tab open?