Redirect to Previous Page in Client Script

dalton1
Giga Expert

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?

9 REPLIES 9

PrashantLearnIT
Giga Sage

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
********************************************************************************************************

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


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?


Kalaiarasan Pus
Giga Sage

Try window.location.href