Redirect to Previous Page in Client Script
This content was last updated in 2018. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2015 10:33 PM
Hi,
I would like to ask how to redirect the user to a previously visited page after click of Submit. Code will be put in the client script. I have tried below option but to no avail:
- action.setReturnURL(current);
Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2015 10:49 PM
Hi
Use
action.setRedirectURL(previous);
Thanks
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2015 11:15 PM
I don't think there is a "previous" if you're coming from a list view and not a form.
Out of box on incident table when clicking on Submit you get redirected automatically to last visited page/list view/etc.
This is the content of Submit UI action for incident table which uses script includes ActionUtils:
answer = current.insert();
gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2015 11:41 PM
HI sergiu.panaite and prashant0007,
I cannot use the action, previous, current and gs objects since I need to code in the client script. Are there any alternatives available for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2015 02:02 AM
Try window.location.href