Redirection to a page outside of SharePoint after saving a form

Today, I would like to demonstrate how to set up a redirection if a page outside of the current SharePoint domain.

The crux of the problem

A redirection to a page withing the current domain can be set up easily in Forms Designer → General Settings. Just specify a server-relative URL in the ‘Redirect after submission URL’ field.
But what if you want to redirect to a page outside of your SharePoint domain. SharePoint does not allow you to do that but you can bypass the limit by following the steps below.

Solution

First, you should create a redirection page withing your SharePoint domain. Then, insert a script that redirects users to an arbitrary page.

  1. Go to Site Contents and switch to Classic View, if you have Modern View now
    Switch to Classic View
  2. Go to Site Pages and add a new page, name it “Redirection”, for example
  3. Go to Insert → Web Part → Media and Content → Script Editor, click “Add”

    Add Web Part

  4. Open a context menu of Script Editor, click “Edit Web Part”

    Edit Web Part

  5. Click “Edit snippet”

    Edit Snippet

  6. Add this code:
    	<script>
        window.location.href = "Your URL"
        </script>
    
  7. Save the web part.

    Save

Finally, add this code to your form:

   fd.onsubmit(function() {
       fd.sourceFormParam("URL of your redirection page");
       return true;
   }); 

Or just insert a link to your redirection page to General → ‘Redirect after submission URL’ field

Hope the solution will be helpful. Don’t hesitate to ask your questions.

Recommend this: