Return to new page on close

I’m no coder, which is why I need some help with this. On form close (or save) I want to redirect the user to the previous page. I’m currently using a static URL redirect on close but it’s not exactly what I’m trying to accomplish.

Can anyone help with a quick code sample?

Dear, @Gabegia ,

By default, a user is redirected on the previous page after form close/submission.

Could you please clarify the points below, so I could help you:

  • how the form is opened (new window, dialog)?
  • where the form is placed, on what pages?
  • to what page user should be redirected?
  • The form is in a SharePoint online list, and the user is being directed there from a separate website (our 3rd party intranet site, hosted in Unily) via hyperlink to the NewItem.aspx link
  • The form is being opened in the SharePoint page (library)
  • The user should be sent back to the previous webpage they were on

Related, but tangential -
I’ve also noticed different results if I save the form vs. close the form - sometimes the JS will redirect me to the page I want, other times it will just take me back to the SharePoint list. Are the onsave and onclose 2 different JS commands?

Thanks for your help!

Dear, @Gabegia ,

If you need a user to be redirected both on save and close, the easiest way is to set the link on the 3rd party site to:

<your SharePoint list link>/Item/NewForm.aspx?source=<page link>

If you do so, a user will be redirected to that page both on save and close with no extra coding required.

1 Like

Awesome - thank you for the tip, I’ll try it out!

Edit - worked like a charm, thanks @mnikitina!

1 Like