
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 07:14 PM
Hi Guys,
Is it possible to get previous page URL ? Basically we have a scenario. We have a table say 'problem' and have a related list as 'incident' table. So, if i click on one of related incident it goes to incident table. Here can we get that previous URL / Page belongs to problem record?
We have gs.action.getGlideURI().toString() which will give current page URL only but cannot give previous page URL.
Let me know if this is feasible.
Thanks,
Suresh
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 10:31 PM
You can try:
GlideSession.get().getStack().bottom();
This will return something like:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 10:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 03:49 AM
Hi Suresh,
Did this answer your question? If so, please mark the answer Correct. this will close the thread and lets others find the answer as well.
If not, please let us know how we can help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2020 07:47 PM
Hi All,
I just used a boolean field on a table and set it when i visit the page this has solved my requirement.
Thanks,
Suresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2021 09:27 AM
I created this function which will give you back the URL that is second from the top of the stack. Unfortunately, it's not 100% accurate at getting the previous page if the user is browsing ServiceNow in multiple tabs/windows at the same time but it works well enough for my use case.
function getPreviousURL() {
var stack = GlideSession.get().getStack();
var topOfStack = stack.pop();
var previousURL = stack.pop();
stack.push(previousURL);
stack.push(topOfStack);
return previousURL;
}