Set Return URL as URL parameter

Andrii
Kilo Guru

When creating new module - is it possible to set redirect URL as URL parameter?

11 REPLIES 11

Patrick DeCarl1
ServiceNow Employee

You could update the UI Action to instead "setReturnURL()" Below is an example.



action.setRedirectURL(change); <--Change is the record we just created from another task table


action.setReturnURL(current);   <-- Current is the record you want to come back to once you're done on the change record.



Check out Difference between setRedirectURL() and setReturnURL()


as I said - I want to achieve tihs without editing UI Action


Hi,


I know that this answer comes very late. And I can only answer that because I stumbled over the solution to this:



1. in your URL you have to add a parameter that contains the return URL ex.: '...&sysparm_redirect_url='+current.getTableName()+'.do?sys_id='+current.getUniqueValue()



2. get the parameter in your UI Page:


<input type="hidden" id="signature_redirect_url" name="signature_redirect_url" value="${sysparm_redirect_url}"></input>



3. in the UI Page processing script add something like:


if (signature_redirect_url)


        response.sendRedirect(signature_redirect_url);


else ...


PriyaRanji
Tera Guru

Hi,



Good Day



can you please try with the below code :



action.setReturnURL(current);



Thanks,


Priyanka R