
- 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 07:22 PM
One way to think about this is how are those records related?
If you're now on an incident record from a related list that was on a problem record, chances are...it's because you have it set to show incidents that have this problem listed on their record, right?
So, you just use a basic URL like:
var url = "https://instance.service-now.com/task.do?sys_id=" + current.problem_id;
or instead of current.problem_id, if this is a client script, you can use: g_form.getValue('problem_id')
Now you can use url.
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-25-2020 07:36 PM
Hi Allen,
May be above use case is not accurate. I have a custom table say 'xyz' and has a reference field called 'incident ' on xyz table. So when i directly open incident record by navigating to incidents and opening particular record, then i have no action/logic to be executed. But when i open the record from the 'xyz' table and clicking on 'i' icon on 'incident' field and then open incident form , then i need to make some logic.
Here the trick is how to get the previous page URL. as if i navigate to incident table, i didn't have any common field which points to 'xyz' table to distinguish.
Thanks,
Suresh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 08:14 PM
Hi Suresh
refer the following thread might help you.
If it help mark helpful or correct.
Thanks and regards
Anil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 09:39 PM
If you just want to go back you can use 'history.back();' in client script.
Regards
Deepen shah
aavenir.com