Redirect to Previous Page in Client Script
- 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
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************
- 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