How do I redirect from one page to another Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-17-2019 09:21 PM
Hi,
I have a requirement to go to an intermediate page after login, check for user sites and redirect to different page based on the condition. This has to happen automatically without any user action
Where should I write the script in the intermediate page? It is similar to onload in traditional JS
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-17-2019 10:34 PM
Hi,
You can redirect from one page to another page in service portal by using below line of code.
If you want to redirect list view by clicking on a link then write below line in your HTML of widget
And put your condition in filter=" " in link
<a href="?id=list&table=incident&filter=active=true"/>
For form view, give sys_id in link
<a href="?id=form&table=incident&sys_id=46e482d9a9fe198101d3e3f3e2a14459 &view=ess"/>
Mark correct/helpful if it helps for you.
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-18-2019 03:55 AM
This is from the Service Portal. I have an intermediate page with no form elements, but I want to process some logic there and based on the outcome it has to redirect to different page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-02-2022 09:13 PM
Use Javascript:
window.location.replace('http://example.com');
It's better than using window.location.href = 'http://example.com';
Using replace() is better because it does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco.
If you want to simulate someone clicking on a link, use window.location.href
If you want to simulate an HTTP redirect, use window.location.replace
You can use assign() and replace methods also to javascript redirect to other pages like the following:
location.assign("http://example.com");
The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the "back" button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-02-2022 09:27 PM